public static LIntT ShiftLeft(LIntT low, HIntT high, out HIntT highResult) { unchecked { const int count = 1; if (count < 64) { if (count == 0) { highResult = high; return(low); } highResult = (HIntT)(((UIntT)high << count) | ((UIntT)low >> (64 - count))); return((LIntT)(low << count)); } else if (count > 64) { highResult = (HIntT)(low << (count - 64)); } else { highResult = (HIntT)low; } return((LIntT)0); } }
public static LIntT ShiftRightSigned(LIntT low, HIntT high, out HIntT highResult) { unchecked { const int count = 1; if (count < 64) { if (count == 0) { highResult = high; return(low); } highResult = (HIntT)((IntT)high >> count); return((LIntT)(((UIntT)low >> count) | ((UIntT)high << (64 - count)))); } else if (count > 64) { if (0 > (IntT)high) { highResult = (HIntT)(IntT)(-1); return((LIntT)(((UIntT)high >> (count - 64)) | (UIntT.MaxValue << (64 + 64 - count)))); } else { highResult = (HIntT)0; return((LIntT)((UIntT)high >> (count - 64))); } } else { highResult = (0 > (IntT)high) ? (HIntT)(IntT)(-1) : (HIntT)0; return((LIntT)high); } } }
public static LIntT ShiftRightUnsigned(LIntT low, HIntT high, out HIntT highResult) { unchecked { const int count = 1; if (count < sizeof(IntT)) { /* * if (count == 0) { * highResult = high; * return low; * } */ highResult = (HIntT)((UIntT)high >> count); return((LIntT)(((UIntT)low >> count) | ((UIntT)high << (-count /* sizeof(IntT) - count */)))); } else { highResult = (HIntT)0; if (count > sizeof(IntT)) { return((LIntT)((UIntT)high >> (count /* - sizeof(IntT)*/))); } else { return((LIntT)high); } } } }
public static LIntT ShiftRightUnsigned(LIntT low, HIntT high, out HIntT highResult) { unchecked { const int count = 1; if (count < 64) { if (count == 0) { highResult = high; return(low); } highResult = (HIntT)((UIntT)high >> count); return((LIntT)(((UIntT)low >> count) | ((UIntT)high << (64 - count)))); } else { highResult = (HIntT)0; if (count > 64) { return((LIntT)((UIntT)high >> (count - 64))); } else { return((LIntT)high); } } } }
public static LIntT ShiftLeft(LIntT low, HIntT high, out HIntT highResult) { unchecked { const int count = 1; if (count < sizeof(IntT)) { /* * if (count == 0) { * highResult = high; * return low; * } */ highResult = (HIntT)(((UIntT)high << count) | ((UIntT)low >> (-count /* sizeof(IntT) - count */))); return((LIntT)(low << count)); } else if (count > sizeof(IntT)) { highResult = (HIntT)(low << (count /* - sizeof(IntT)*/)); } else { highResult = (HIntT)low; } return((LIntT)0); } }
public static LIntT DecreaseUnsigned(LIntT value_lo, HIntT value_hi, out HIntT result_hi) { var result_lo_ = value_lo; unchecked { --result_lo_; } var result_hi_ = unchecked ((UIntT)value_hi); result_hi_ = ((LIntT)0 == value_lo ? checked (--result_hi_) : result_hi_); result_hi = unchecked ((HIntT)result_hi_); return(result_lo_); }
public static LIntT IncreaseSigned(LIntT value_lo, HIntT value_hi, out HIntT result_hi) { var result_lo_ = value_lo; unchecked { ++result_lo_; } var result_hi_ = unchecked ((IntT)value_hi); result_hi_ = (~(LIntT)0 == value_lo ? checked (++result_hi_) : result_hi_); result_hi = unchecked ((HIntT)result_hi_); return(result_lo_); }
public static LIntT IncreaseUnchecked(LIntT value_lo, HIntT value_hi, out HIntT result_hi) { var result_lo_ = value_lo; unchecked { ++result_lo_; } var result_hi_ = unchecked ((HIntT)value_hi); unchecked { result_hi_ += unchecked ((HIntT)(~(LIntT)0 == value_lo).AsIntegerUnsafe()); } result_hi = unchecked ((HIntT)result_hi_); return(result_lo_); }
public static LIntT DecreaseSigned(LIntT value_lo, HIntT value_hi, out HIntT result_hi) { var result_lo_ = value_lo; unchecked { --result_lo_; } var result_hi_ = unchecked ((IntT)value_hi); checked { result_hi_ -= unchecked ((IntT)(~(LIntT)0 == value_lo).AsIntegerUnsafe()); } result_hi = unchecked ((HIntT)result_hi_); return(result_lo_); }
public static int Compare(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { if (first_hi < second_hi) { return(-1); } if (first_hi > second_hi) { return(1); } if (first_lo < second_lo) { return(-1); } if (first_lo > second_lo) { return(1); } return(0); }
public static LIntT ShiftRightSigned(LIntT low, HIntT high, out HIntT highResult) { unchecked { const int count = 1; if (count < sizeof(IntT)) { /* * if (count == 0) { * highResult = high; * return low; * } */ highResult = (HIntT)((IntT)high >> count); return((LIntT)(((UIntT)low >> count) | ((UIntT)high << (-count /* sizeof(IntT) - count */)))); } else { var mask = (UIntT)(-((IntT)high >> (sizeof(IntT) - 1))); highResult = (HIntT)mask; if (count > sizeof(IntT)) { // if (0 > (IntT)high) { // highResult = (HIntT)(IntT)(-1); // return (LIntT)(((UIntT)high >> (count/* - sizeof(IntT)*/)) | (UIntT.MaxValue << (-count/* sizeof(IntT) + sizeof(IntT) - count */))); // } else { // highResult = (HIntT)0; // return (LIntT)((UIntT)high >> (count/* - sizeof(IntT)*/)); // } return((LIntT)(((UIntT)high >> (count /* - sizeof(IntT)*/)) | (mask << (-count /* sizeof(IntT) + sizeof(IntT) - count */)))); } else { // highResult = (0 > (IntT)high) ? (HIntT)(IntT)(-1) : (HIntT)0; return((LIntT)high); } } } }
public static bool Equals(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { return(first_lo == second_lo && first_hi == second_hi); }
public static bool NotEqual(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { return(first_lo != second_lo || first_hi != second_hi); }
public static bool LessThan(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { return(first_hi < second_hi || (first_hi == second_hi && first_lo < second_lo)); }
public static LIntT ShiftRight(LIntT low, HIntT high, int count) { return(unchecked ((LIntT)(((UIntT)low >> count) | ((UIntT)high << (64 - count))))); }
public static HIntT ShiftLeft(LIntT low, HIntT high, int count) { return(unchecked ((HIntT)(((UIntT)high << count) | ((UIntT)low >> (64 - count))))); }
public static bool LessThanOrEqual(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { return(first_hi <= second_hi && (first_hi != second_hi || first_lo <= second_lo)); }
public static LIntT ShiftRight(LIntT low, HIntT high, int count) { return(unchecked ((LIntT)(((UIntT)low >> count) | ((UIntT)high << (-count /* sizeof(IntT) - count */))))); }
public static bool GreaterThanOrEqual(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { return(first_hi >= second_hi && (first_hi != second_hi || first_lo >= second_lo)); }
public static bool GreaterThan(LIntT first_lo, HIntT first_hi, LIntT second_lo, HIntT second_hi) { return(first_hi > second_hi || (first_hi == second_hi && first_lo > second_lo)); }