nttlTraits Method - Mod8

Description
For a given value, x, return x mod 8.

The usual way of calculating x mod 8 is to use operator%.  This involves a division operation, which is intrinsically slow.  A better way to calculate this is to use operator& (x & 7).  Even this is slower than it needs to be.  For a multiple precision integer, only the least significant digit needs to be considered.

The default implementation of this method uses x mod 8, since not all multiple precision libraries implement operator&.  The optimization mentioned above should be implemented in a specialization for type T, if applicable.

Signature
template<class T> short nttlTraits::Mod8( const T& x )
Parameters
Name Type Description
x T Some number.
Returns
( short )  x mod 8, as described above.
Example
#include <nttl/nttlTraits.h>
...
nttlTraits<int> tr;
...
int x = 123;
int a = tr.Mod8( x );