openMSX
Public Member Functions | List of all members
openmsx::DivModBySame Class Reference

Helper class to divide multiple times by the same number. More...

#include <DivModBySame.hh>

Public Member Functions

void setDivisor (uint32_t divisor)
 
uint32_t getDivisor () const
 
uint32_t div (uint64_t dividend) const
 
uint32_t divInC (uint64_t dividend) const
 
std::pair< uint32_t, uint32_t > divMod (uint64_t dividend) const
 
uint32_t mod (uint64_t dividend) const
 

Detailed Description

Helper class to divide multiple times by the same number.

Binary division can be performed by:

If the divisor is a compile-time constant, it's even faster to use the DivModByConst utility class.

Definition at line 25 of file DivModBySame.hh.

Member Function Documentation

◆ div()

uint32_t openmsx::DivModBySame::div ( uint64_t  dividend) const
inline

◆ divInC()

uint32_t openmsx::DivModBySame::divInC ( uint64_t  dividend) const
inline

Definition at line 41 of file DivModBySame.hh.

Referenced by div().

◆ divMod()

std::pair< uint32_t, uint32_t > openmsx::DivModBySame::divMod ( uint64_t  dividend) const
inline

Definition at line 61 of file DivModBySame.hh.

References div().

Referenced by openmsx::DynamicClock::getTicksTillAsIntFloat(), and mod().

◆ getDivisor()

uint32_t openmsx::DivModBySame::getDivisor ( ) const
inline

Definition at line 29 of file DivModBySame.hh.

◆ mod()

uint32_t openmsx::DivModBySame::mod ( uint64_t  dividend) const
inline

Definition at line 71 of file DivModBySame.hh.

References divMod().

Referenced by openmsx::DynamicClock::advance().

◆ setDivisor()

void openmsx::DivModBySame::setDivisor ( uint32_t  divisor)

Definition at line 7 of file DivModBySame.cc.

References t.

Referenced by openmsx::DynamicClock::setPeriod().


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