UIntExtensions

Static Class in Zigurous.Math

Declaration

public static class UIntExtensions

Description

Extension methods for unsigned integers.

Extension Methods

FactorsReturns the factors of the given number.
GetBitsReturns a subset of bits from the number.
HasFlagChecks if a given flag is set in the bitmask. (mask & flag) == flag
HasAnyFlagChecks if any of the given flags are set in the bitmask. (mask & flags) != 0
IsEvenChecks if the number is even. n % 2 == 0
IsOddChecks if the number is odd. n % 2 != 0
IsZeroChecks if the number is zero. n == 0
IsPositiveChecks if the number is positive. n > 0
ToBinaryStringConverts the number to a string of binary digits.