Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::sat::QuickSmallDivision Class Reference

#include <integer.h>

Public Member Functions

 QuickSmallDivision (uint16_t divisor)
 
uint16_t DivideByDivisor (uint16_t dividend) const
 

Detailed Description

Helper for dividing several small integers by the same value. Note that there is no point using this class is the divisor is a compile-time constant, since the compiler should be smart enough to do this automatically. Building a QuickSmallDivision object costs an integer division, but each call to DivideByDivisor will only do an integer multiplication and a shift.

This class always return the exact value of the division for all possible values of dividend and divisor.

Definition at line 133 of file integer.h.

Constructor & Destructor Documentation

◆ QuickSmallDivision()

operations_research::sat::QuickSmallDivision::QuickSmallDivision ( uint16_t divisor)
inlineexplicit

Definition at line 135 of file integer.h.

Member Function Documentation

◆ DivideByDivisor()

uint16_t operations_research::sat::QuickSmallDivision::DivideByDivisor ( uint16_t dividend) const
inline

Definition at line 138 of file integer.h.


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