本文整理匯總了C#中System.Int32.SAR方法的典型用法代碼示例。如果您正苦於以下問題:C# Int32.SAR方法的具體用法?C# Int32.SAR怎麽用?C# Int32.SAR使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Int32
的用法示例。
在下文中一共展示了Int32.SAR方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DecomposeBits
/// <summary>
/// Overloaded.
/// Disassembles an integer to specified bits.
/// </summary>
/// <param name="H">First Byte</param>
/// <param name="HU">Upper Index of the First Byte (7-0)</param>
/// <param name="HL">Lower Index of the First Byte (7-0)</param>
/// <param name="S">Second Byte</param>
/// <param name="SU">Upper Index of the Second Byte (7-0)</param>
/// <param name="SL">Lower Index of the Second Byte (7-0)</param>
/// <param name="value">Value to be disassembled</param>
public static void DecomposeBits(Int32 value, ref Byte H, Int32 HU, Int32 HL,
ref Byte S, Int32 SU, Int32 SL)
{
Int32 Hp = value.SAR(SU - SL + 1) & (1.SAL(HU - HL + 1) - 1);
H = (byte) (H & ~Convert.ToByte((1.SAL(HU - HL + 1) - 1).SAL(HL)));
H = (byte) (H | Convert.ToByte(Hp.SAL(HL)));
Int32 SPart = value & (1.SAL(SU - SL + 1) - 1);
S = (byte) (S & ~Convert.ToByte((1.SAL(SU - SL + 1) - 1).SAL(SL)));
S = (byte) (S | Convert.ToByte(SPart.SAL(SL)));
}