dmi_ipow32

Synopsis

#include <opendmi/utils.h>

uint32_t dmi_ipow32(uint32_t value, unsigned int factor);
uint64_t dmi_ipow64(uint64_t value, unsigned int factor);

Description

The dmi_ipow32 and dmi_ipow64 functions raise value to the power factor in unsigned integer arithmetic of 32 and 64 bits, by binary exponentiation, e.g. to scale a value by a power of ten given in SMBIOS data. Any value raised to the power of zero is 1, zero included.

A result which does not fit in the type wraps around, as unsigned multiplication does: the functions return it modulo 232 and 264.

Parameters

value

Base.

factor

Exponent.

Return value

The functions return value raised to the power factor, modulo 232 or 264.

Errors

None.

See also

pow(3)