当前位置: 首页>>代码示例>>C#>>正文


C# ILuaState.L_CheckUnsigned方法代码示例

本文整理汇总了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;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:16,代码来源:LuaBitLib.cs

示例2: Math_RandomSeed

		private static int Math_RandomSeed( ILuaState lua )
		{
			RandObj = new Random( (int)lua.L_CheckUnsigned(1) );
			RandObj.Next();
			return 0;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:6,代码来源:LuaMathLib.cs

示例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 );
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:10,代码来源:LuaBitLib.cs

示例4: B_RightShift

		private static int B_RightShift( ILuaState lua )
		{
			return B_Shift( lua, lua.L_CheckUnsigned(1), -lua.L_CheckInteger(2) );
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:4,代码来源:LuaBitLib.cs

示例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;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:12,代码来源:LuaBitLib.cs

示例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;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:9,代码来源:LuaBitLib.cs

示例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;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:9,代码来源:LuaBitLib.cs

示例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;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:11,代码来源:LuaBitLib.cs

示例9: B_Not

		private static int B_Not( ILuaState lua )
		{
			uint r = ~lua.L_CheckUnsigned( 1 );
			lua.PushUnsigned( Trim(r) );
			return 1;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:6,代码来源:LuaBitLib.cs


注:本文中的ILuaState.L_CheckUnsigned方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。