本文整理汇总了C#中ILuaState.L_CheckUnsigned方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_CheckUnsigned方法的具体用法?C# ILuaState.L_CheckUnsigned怎么用?C# ILuaState.L_CheckUnsigned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILuaState
的用法示例。
在下文中一共展示了ILuaState.L_CheckUnsigned方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: B_ArithShift
private static int B_ArithShift( ILuaState lua )
{
uint r = lua.L_CheckUnsigned( 1 );
int i = lua.L_CheckInteger( 2 );
if( i < 0 || ((r & ((uint)1 << (LUA_NBITS-1))) == 0) )
return B_Shift( lua, r, -i );
else // arithmetic shift for `nagetive' number
{
if( i>= LUA_NBITS )
r = ALLONES;
else
r = Trim((r >> i) | ~(~(uint)0 >> i)); // add signal bit
lua.PushUnsigned( r );
}
return 1;
}
示例2: Math_RandomSeed
private static int Math_RandomSeed( ILuaState lua )
{
RandObj = new Random( (int)lua.L_CheckUnsigned(1) );
RandObj.Next();
return 0;
}
示例3: AndAux
private static uint AndAux( ILuaState lua )
{
int n = lua.GetTop();
uint r = ~(uint)0;
for( int i=1; i<=n; ++i )
{
r &= lua.L_CheckUnsigned( i );
}
return Trim( r );
}
示例4: B_RightShift
private static int B_RightShift( ILuaState lua )
{
return B_Shift( lua, lua.L_CheckUnsigned(1), -lua.L_CheckInteger(2) );
}
示例5: B_Replace
private static int B_Replace( ILuaState lua )
{
uint r = lua.L_CheckUnsigned( 1 );
uint v = lua.L_CheckUnsigned( 2 );
int w;
int f = FieldArgs( lua, 3, out w );
uint m = Mask( w );
v &= m; //erase bits outside given width
r = (r & ~(m << f)) | (v << f);
lua.PushUnsigned( r );
return 1;
}
示例6: B_Rotate
private static int B_Rotate( ILuaState lua, int i )
{
uint r = lua.L_CheckUnsigned( 1 );
i &= (LUA_NBITS-1); // i = i % NBITS
r = Trim( r );
r = (r << i) | (r >> (LUA_NBITS - i));
lua.PushUnsigned( Trim(r) );
return 1;
}
示例7: B_Extract
private static int B_Extract( ILuaState lua )
{
uint r = lua.L_CheckUnsigned( 1 );
int w;
int f = FieldArgs( lua, 2, out w );
r = (r >> f) & Mask(w);
lua.PushUnsigned( r );
return 1;
}
示例8: B_Xor
private static int B_Xor( ILuaState lua )
{
int n = lua.GetTop();
uint r = 0;
for( int i=1; i<=n; ++i )
{
r ^= lua.L_CheckUnsigned( i );
}
lua.PushUnsigned( Trim(r) );
return 1;
}
示例9: B_Not
private static int B_Not( ILuaState lua )
{
uint r = ~lua.L_CheckUnsigned( 1 );
lua.PushUnsigned( Trim(r) );
return 1;
}