Regina 7.3 Calculation Engine
Static Public Member Functions | Static Public Attributes | List of all members
regina::BitManipulatorBySize< T, size > Class Template Reference

Contains implementation details for BitManipulator where we optimise according to the size of the underlying data type. More...

#include <utilities/bitmanip.h>

Inheritance diagram for regina::BitManipulatorBySize< T, size >:
regina::BitManipulator< T >

Static Public Member Functions

static constexpr int bits (T x)
 Returns the number of bits that are set to 1 in the given integer. More...
 

Static Public Attributes

static constexpr bool specialised = false
 Indicates whether this class is a template specialisation of BitManipulatorBySize with extra optimisations. More...
 

Detailed Description

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

Contains implementation details for BitManipulator where we optimise according to the size of the underlying data type.

End users should use the BitManipulator class, not this class.

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. Only the end-user class BitManipulator<unsigned long> is available to Python users.
Template Parameters
Tan unsigned integral numeric type, which we treat as a sequence of true and/or false bits.
sizethe number of bytes of T to examine. Any higher-order bits will be ignored by the implementations in this class.

Member Function Documentation

◆ bits()

template<typename T , unsigned size = sizeof(T)>
static constexpr int regina::BitManipulatorBySize< T, size >::bits ( x)
inlinestaticconstexpr

Returns the number of bits that are set to 1 in the given integer.

Note that this routine will become redundant once we move to C++20, since we will be able to use std::popcount() instead.

Parameters
xthe integer of type T to examine.
Returns
the number of bits that are set.

Member Data Documentation

◆ specialised

template<typename T , unsigned size = sizeof(T)>
constexpr bool regina::BitManipulatorBySize< T, size >::specialised = false
staticconstexpr

Indicates whether this class is a template specialisation of BitManipulatorBySize with extra optimisations.

This compile-time constant is set to false for the generic implementation of BitManipulatorBySize, and true for all specialisations.


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

Copyright © 1999-2023, 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@maths.uq.edu.au).