namespace JXCMS.Core.Encrypt
{
public class SupportClass
{
///
/// Performs an unsigned bitwise right shift with the specified number
///
///Number to operate on
///Ammount of bits to shift
/// The resulting number from the shift operation
public static int URShift(int number, int bits)
{
if (number >= 0)
return number >> bits;
else
return (number >> bits) + (2 << ~bits);
}
///
/// Performs an unsigned bitwise right shift with the specified number
///
///Number to operate on
///Ammount of bits to shift
/// The resulting number from the shift operation
public static int URShift(int number, long bits)
{
return URShift(number, (int)bits);
}
///
/// Performs an unsigned bitwise right shift with the specified number
///
///Number to operate on
///Ammount of bits to shift
/// The resulting number from the shift operation
public static long URShift(long number, int bits)
{
if (number >= 0)
return number >> bits;
else
return (number >> bits) + (2L << ~bits);
}
///
/// Performs an unsigned bitwise right shift with the specified number
///
///Number to operate on
///Ammount of bits to shift
/// The resulting number from the shift operation
public static long URShift(long number, long bits)
{
return URShift(number, (int)bits);
}
}
}