ComponentAce.Compression.Libs.zlib.SupportClass.URShift C# (CSharp) Method

URShift() public static method

Performs an unsigned bitwise right shift with the specified number
public static URShift ( int number, int bits ) : int
number int Number to operate on
bits int Ammount of bits to shift
return int
        public static int URShift(int number, int bits)
        {
            if ( number >= 0)
                return number >> bits;
            else
                return (number >> bits) + (2 << ~bits);
        }

Same methods

SupportClass::URShift ( int number, long bits ) : int
SupportClass::URShift ( long number, int bits ) : long
SupportClass::URShift ( long number, long bits ) : long

Usage Example

Example #1
0
        internal static int bi_reverse(int code, int len)
        {
            int num = 0;

            do
            {
                num  |= code & 1;
                code  = SupportClass.URShift(code, 1);
                num <<= 1;
            }while (--len > 0);
            return(SupportClass.URShift(num, 1));
        }
All Usage Examples Of ComponentAce.Compression.Libs.zlib.SupportClass::URShift