Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
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 Loyc.Math.MathI Loyc.Math.MathI16 Loyc.Math.MathI8 Loyc.Math.MathL Loyc.Math.MathU Loyc.Math.MathU16 Loyc.Math.MathU8 Loyc.Math.MathUL

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)
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, Loyc.Math.MathF8, Loyc.Math.MathUL, Loyc.Math.MathL, Loyc.Math.MathU, Loyc.Math.MathI, Loyc.Math.MathU16, Loyc.Math.MathI16, Loyc.Math.MathU8, and Loyc.Math.MathI8.

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, Loyc.Math.MathF8, Loyc.Math.MathUL, Loyc.Math.MathL, Loyc.Math.MathU, Loyc.Math.MathI, Loyc.Math.MathU16, Loyc.Math.MathI16, Loyc.Math.MathU8, and Loyc.Math.MathI8.

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