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


C# ILuaState.PushUnsigned方法代码示例

本文整理汇总了C#中ILuaState.PushUnsigned方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.PushUnsigned方法的具体用法?C# ILuaState.PushUnsigned怎么用?C# ILuaState.PushUnsigned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILuaState的用法示例。


在下文中一共展示了ILuaState.PushUnsigned方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: B_Shift

		private static int B_Shift( ILuaState lua, uint r, int i )
		{
			if( i < 0 ) // shift right?
			{
				i = -i;
				r = Trim( r );
				if( i >= LUA_NBITS ) r = 0;
				else r >>= i;
			}
			else // shift left
			{
				if( i >= LUA_NBITS ) r = 0;
				else r <<= i;
				r = Trim(r);
			}
			lua.PushUnsigned( r );
			return 1;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:18,代码来源:LuaBitLib.cs

示例3: B_And

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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

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