regina::GenericBitManipulator< T, size > Class Template Reference
Utilities

A generic class for bitwise analysis and manipulation of native data types. More...

`#include <utilities/bitmanip.h>`

Inheritance diagram for regina::GenericBitManipulator< T, size >:

## Static Public Member Functions

static int | firstBit (T x)
| Returns the index of the first `true` bit in the given integer, or -1 if the given integer is zero. More...
static int | lastBit (T x)
| Returns the index of the last `true` bit in the given integer, or -1 if the given integer is zero. More...

## Detailed Description

### template<typename T, unsigned size = sizeof(T)>
class regina::GenericBitManipulator< T, size >

A generic class for bitwise analysis and manipulation of native data types.

This class is not optimised for common data types; its sole functionality is to provide default implementations for some operations that are not yet optimised (or do not need to be).

End users should use BitManipulator<T, size> instead, which is better optimised and which has all the functionality of this class.

See BitManipulator for further information.

Precondition
  Type T is an unsigned integral numeric type.
  The argument size is a power of two, and is at most sizeof(T).

Python:
  Not present.

## Member Function Documentation

template<typename T , unsigned size = sizeof(T)>

static int regina::GenericBitManipulator< T, size >::firstBit | ( | T | x | ) |

inline static

Returns the index of the first `true` bit in the given integer, or -1 if the given integer is zero.

Bits are indexed from 0 upwards, starting at the least significant bit.

Parameters

  x | the integer of type T to examine.

Returns
  the position of the first `true` bit, or -1 if there are no `true` bits.

template<typename T , unsigned size = sizeof(T)>

static int regina::GenericBitManipulator< T, size >::lastBit | ( | T | x | ) |

inline static

Returns the index of the last `true` bit in the given integer, or -1 if the given integer is zero.

Bits are indexed from 0 upwards, starting at the least significant bit.

Parameters

  x | the integer of type T to examine.

Returns
  the position of the last `true` bit, or -1 if there are no `true` bits.

The documentation for this class was generated from the following file:

- utilities/bitmanip.h

Copyright © 1999-2014, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).