Enhanced C#
Language of your choice: library documentation
Public Member Functions | List of all members
Loyc.Math.IBinaryMath< T > Interface Template Reference

Provides additional bit-oriented integer operations. More...


Source file:
Inheritance diagram for Loyc.Math.IBinaryMath< T >:
Loyc.Math.IBitwise< T > Loyc.Math.IZeroProvider< T > Loyc.Math.IOneProvider< T > Loyc.Math.IIntMath< T > Loyc.Math.IUIntMath< T > Loyc.Math.MathF16 Loyc.Math.MathF23 Loyc.Math.MathF8 Loyc.Math.MathFL16 Loyc.Math.MathFL32

Remarks

Provides additional bit-oriented integer operations.

Template Parameters
TAn integer or integer-based types.

Public Member Functions

Shl (T a, int amount)
 Shifts 'a' left by the specified number of bits. More...
 
Shr (T a, int amount)
 Shifts 'a' right by the specified number of bits. More...
 
int CountOnes (T a)
 Returns the number of '1' bits in 'a'. More...
 
int Log2Floor (T a)
 Returns the floor of the base-2 logarithm of x. e.g. 1024 -> 10, 1000 -> 9 More...
 
- Public Member Functions inherited from Loyc.Math.IBitwise< T >
And (T a, T b)
 
Or (T a, T b)
 
Xor (T a, T b)
 
Not (T a)
 

Additional Inherited Members

- Properties inherited from Loyc.Math.IZeroProvider< T >
Zero [get]
 Returns the "zero" or additive identity of this type. More...
 
- Properties inherited from Loyc.Math.IOneProvider< T >
One [get]
 Returns the "one" or identity value of this type. More...
 

Member Function Documentation

int Loyc.Math.IBinaryMath< T >.CountOnes ( a)

Returns the number of '1' bits in 'a'.

Implemented in Loyc.Math.MathFL32, Loyc.Math.MathFL16, Loyc.Math.MathF23, Loyc.Math.MathF16, and Loyc.Math.MathF8.

int Loyc.Math.IBinaryMath< T >.Log2Floor ( a)

Returns the floor of the base-2 logarithm of x. e.g. 1024 -> 10, 1000 -> 9

The return value is int.MinValue for an input of zero (for which the logarithm is technically undefined.)

Implemented in Loyc.Math.MathFL32, Loyc.Math.MathFL16, Loyc.Math.MathF23, Loyc.Math.MathF16, and Loyc.Math.MathF8.

T Loyc.Math.IBinaryMath< T >.Shl ( a,
int  amount 
)

Shifts 'a' left by the specified number of bits.

A shift amount A negative shift amount produces undefined results

Implemented in Loyc.Math.MathFL32, Loyc.Math.MathFL16, Loyc.Math.MathF23, Loyc.Math.MathF16, and Loyc.Math.MathF8.

T Loyc.Math.IBinaryMath< T >.Shr ( a,
int  amount 
)

Shifts 'a' right by the specified number of bits.

Implemented in Loyc.Math.MathFL32, Loyc.Math.MathFL16, Loyc.Math.MathF23, Loyc.Math.MathF16, and Loyc.Math.MathF8.