openMSX
Public Member Functions | Public Attributes | List of all members
openmsx::power_of_two< T > Struct Template Reference

A constexpr power_of_two struct for power of two numbers, with compact storage and built-in value correctness assertion. More...

#include <power_of_two.hh>

Inheritance diagram for openmsx::power_of_two< T >:
Inheritance graph
[legend]

Public Member Functions

constexpr power_of_two (T size)
 
constexpr operator T () const
 

Public Attributes

uint8_t exponent = 0
 

Detailed Description

template<std::unsigned_integral T>
struct openmsx::power_of_two< T >

A constexpr power_of_two struct for power of two numbers, with compact storage and built-in value correctness assertion.

Additionally, the compiler optimises multiplication / division / modulo operations to bit shifts.

Definition at line 18 of file power_of_two.hh.

Constructor & Destructor Documentation

◆ power_of_two()

template<std::unsigned_integral T>
constexpr openmsx::power_of_two< T >::power_of_two ( size)
inlineconstexpr

Definition at line 19 of file power_of_two.hh.

Member Function Documentation

◆ operator T()

template<std::unsigned_integral T>
constexpr openmsx::power_of_two< T >::operator T ( ) const
inlineconstexpr

Definition at line 25 of file power_of_two.hh.

References openmsx::power_of_two< T >::exponent.

Member Data Documentation

◆ exponent

template<std::unsigned_integral T>
uint8_t openmsx::power_of_two< T >::exponent = 0

Definition at line 30 of file power_of_two.hh.

Referenced by openmsx::power_of_two< T >::operator T().


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