public static int Pow2RoundDown(int x) { if (x < 0) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be non-negative"); } return((int)UInt32Util.Pow2RoundDown((uint)x)); }
public static int Pow2RoundUp(int x) { if ((x < 0) || (x > 0x40000000)) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be in the range [1, 2^30]"); } return((int)UInt32Util.Pow2RoundUp((uint)x)); }
public static bool IsClamped(double value, double min, double max) { if (min > max) { ExceptionUtil.ThrowArgumentOutOfRangeException("min", "min must be less than or equal to max"); } return((value >= min) && (value <= max)); }
public static unsafe int Log2(byte x) { if (x == 0) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be 1 or greater"); } return(pHighestBitLookup[x]); }
public static int Log2RoundUp(uint x) { if ((x == 0) || (x > 0x80000000)) { ExceptionUtil.ThrowArgumentOutOfRangeException("x must be in the range [1, 2^31]"); } return(Log2((x - 1) + x)); }
public static int Log2(uint x) { if (x == 0) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be 1 or greater"); } return(HighestBit(x)); }
public static int Log2(int x) { if (x <= 0) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be positive"); } if (x == 1) { return(0); } return(UInt32Util.HighestBit((uint)x)); }
public static uint Pow2RoundUp(uint x) { if (x > 0x80000000) { ExceptionUtil.ThrowArgumentOutOfRangeException("x", "must be less than or equal to 2^31"); } if (x == 0) { return(1); } return(Pow2RoundUpNonZero(x)); }
public static unsafe void CopyElements(void *pDst, void *pSrc, int srcLength, int srcIndex, int elementCount, int elementSize) { if ((pDst == null) || (pSrc == null)) { ExceptionUtil.ThrowArgumentNullException(); } if (((srcLength < 0) || (srcIndex < 0)) || (((elementCount < 0) || (elementSize < 1)) || ((srcIndex + elementCount) > srcLength))) { ExceptionUtil.ThrowArgumentOutOfRangeException(); } if (elementCount != 0) { Buffer.MemoryCopy(pSrc + ((void *)(srcIndex * elementSize)), pDst, (long)(elementCount * elementSize), (long)(elementCount * elementSize)); } }
private static void IsClampedThrow(long value, long min, long max) { ExceptionUtil.ThrowArgumentOutOfRangeException("min", $"min must be less than or equal to max. value={value}, min={min}, max={max}"); }
private static void ClampThrow(int value, int min, int max) { ExceptionUtil.ThrowArgumentOutOfRangeException("min", $"min must be less than or equal to max. value={value}, min={min}, max={max}"); }