tor  0.4.1.0-alpha-dev
Macros | Functions
muldiv.h File Reference
#include "lib/cc/torint.h"

Go to the source code of this file.

Macros

#define CEIL_DIV(a, b)   (((a)+((b)-1))/(b))
 

Functions

unsigned round_to_next_multiple_of (unsigned number, unsigned divisor)
 
uint32_t round_uint32_to_next_multiple_of (uint32_t number, uint32_t divisor)
 
uint64_t round_uint64_to_next_multiple_of (uint64_t number, uint64_t divisor)
 
void simplify_fraction64 (uint64_t *numer, uint64_t *denom)
 

Detailed Description

Header for muldiv.c.

Definition in file muldiv.h.

Function Documentation

◆ round_to_next_multiple_of()

unsigned round_to_next_multiple_of ( unsigned  number,
unsigned  divisor 
)

Return the lowest x such that x is at least number, and x modulo divisor == 0. If no such x can be expressed as an unsigned, return UINT_MAX. Asserts if divisor is zero.

Definition at line 21 of file muldiv.c.

◆ round_uint32_to_next_multiple_of()

uint32_t round_uint32_to_next_multiple_of ( uint32_t  number,
uint32_t  divisor 
)

Return the lowest x such that x is at least number, and x modulo divisor == 0. If no such x can be expressed as a uint32_t, return UINT32_MAX. Asserts if divisor is zero.

Definition at line 35 of file muldiv.c.

◆ round_uint64_to_next_multiple_of()

uint64_t round_uint64_to_next_multiple_of ( uint64_t  number,
uint64_t  divisor 
)

Return the lowest x such that x is at least number, and x modulo divisor == 0. If no such x can be expressed as a uint64_t, return UINT64_MAX. Asserts if divisor is zero.

Definition at line 50 of file muldiv.c.