Skip to main content

Class BitHelper

Inheritance
System.Object
Inherited Members
Show
Syntax
public static class BitHelper

Methods

BitCount(Single, Single)

Gets the number of bits need for precision in range negative to positive max

WARNING: these methods are not fast, dont use in hotpath

Declaration
public static int BitCount(float max, float precision)
Parameters
TypeNameDescription
System.Singlemax
System.Singleprecisionlowest precision required, bit count will round up so real precision might be higher
Returns
TypeDescription
System.Int32

BitCount(Single, Single, Boolean)

Gets the number of bits need for precision in range max If signed then range is negative max to positive max, If unsigned then 0 to max

WARNING: these methods are not fast, dont use in hotpath

Declaration
public static int BitCount(float max, float precision, bool signed)
Parameters
TypeNameDescription
System.Singlemax
System.Singleprecisionlowest precision required, bit count will round up so real precision might be higher
System.Booleansigned
Returns
TypeDescription
System.Int32

BitCount(UInt64)

Gets the number of bits need for max

WARNING: these methods are not fast, dont use in hotpath

Declaration
public static int BitCount(ulong max)
Parameters
TypeNameDescription
System.UInt64max
Returns
TypeDescription
System.Int32