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 24 of file DivModBySame.hh.

Member Function Documentation

◆ div()

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

Definition at line 30 of file DivModBySame.hh.

References divinC(), and t.

Referenced by divMod(), openmsx::DynamicClock::getTicksTill(), and openmsx::DynamicClock::getTicksTillUp().

◆ divinC()

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

Definition at line 40 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 60 of file DivModBySame.hh.

References div().

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

◆ getDivisor()

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

Definition at line 28 of file DivModBySame.hh.

◆ mod()

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

Definition at line 70 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 Math::log2p1(), and t.

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


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