nttlTraits Method - IsEven

Description
For a given value, x, return true if x is even, and false if x is odd.

One typical way of calculating this is to use x % 2.  This involves a division operation, which is intrinsically slow.  A better way to calculate this is to use x & 1.  Even this is slower than it needs to be.  For a multiple precision integer, only the least significant digit needs to be used.

The default implementation of this method uses x & 1.  If the type T does not implement operator&, then this method will have to be specialized for T.

Signature
template<class T> bool nttlTraits::IsEven( const T& x )
Parameters
Name Type Description
x T Some number.
Returns
( bool )  true if x is even; false otherwise.
Example
#include <nttl/nttlTraits.h>
...
nttlTraits<int> tr;
...
int x = 123;
if( tr.IsEven( x ) )
    ...