Skip to main content

Crate fixed_point

Crate fixed_point 

Source
Expand description

Fixed point arithmetic helpers mirroring <lib/fixed_point.h>.

The central type is Fp3264, a 32.64 unsigned fixed point number (32 integer bits and 64 fractional bits) used by platform timer code to convert between clock domains (e.g. TSC ticks to nanoseconds) without floating point.

Structs§

Fp3264
A 32.64 unsigned fixed point number: 32 integer bits followed by 64 fractional bits, stored as three little-endian-by-significance limbs.

Functions§

fp_32_64_div_32_32⚠
Computes dividend / divisor as a 32.64 fixed point value, truncating any fraction below the 64th fractional bit, and stores the result into result.
u32_mul_u64_fp32_64
Multiplies a 64-bit integer a by the 32.64 fixed point value b, returning the low 32 bits of the product rounded to the nearest integer.
u64_mul_u32_fp32_64
Multiplies a 32-bit integer a by the 32.64 fixed point value b, returning the product rounded to the nearest 64-bit integer.
u64_mul_u64_fp32_64
Multiplies a 64-bit integer a by the 32.64 fixed point value b, returning the low 64 bits of the product rounded to the nearest integer.