C# Class BooRunner.Tools.Bits

Contains helping methods to with with bits in dword (UInt32).
Show file Open project: juanplopes/euler

Public Methods

Method Description
CeilLog2 ( uint x ) : int

Ceil(Log2(x)).

Msb ( uint x ) : int

Counts position of the most significant bit in int. Can also be used as Floor(Log2(x)).

Nlz ( uint x ) : int

Returns number of leading zero bits in int.

Method Details

CeilLog2() public static method

Ceil(Log2(x)).
public static CeilLog2 ( uint x ) : int
x uint Int value.
return int

Msb() public static method

Counts position of the most significant bit in int. Can also be used as Floor(Log2(x)).
public static Msb ( uint x ) : int
x uint Int value.
return int

Nlz() public static method

Returns number of leading zero bits in int.
public static Nlz ( uint x ) : int
x uint Int value.
return int