Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
Typedefs | |
typedef int8_t | elm::t::int8 |
typedef uint8_t | elm::t::uint8 |
typedef int16_t | elm::t::int16 |
typedef uint16_t | elm::t::uint16 |
typedef int32_t | elm::t::int32 |
typedef uint32_t | elm::t::uint32 |
typedef int64_t | elm::t::int64 |
typedef uint64_t | elm::t::uint64 |
typedef uint32 | elm::t::size |
typedef uint32 | elm::t::offset |
typedef uint32 | elm::t::uint |
typedef uint32 | elm::t::intptr |
Functions | |
int | elm::msb (t::uint32 i) |
int | elm::msb (t::uint64 i) |
int | elm::ones (t::uint8 i) |
t::uint32 | elm::leastUpperPowerOf2 (t::uint32 v) |
t::uint64 | elm::leastUpperPowerOf2 (t::uint64 v) |
t::uint32 | elm::mult (t::uint32 a, t::uint32, bool &over) |
t::uint64 | elm::mult (t::uint64 a, t::uint64, bool &over) |
t::uint32 | elm::roundup (t::uint32 v, t::uint32 m) |
t::uint32 | elm::rounddown (t::uint32 v, t::uint32 m) |
int | elm::ones (t::uint16 i) |
int | elm::ones (t::uint64 i) |
This module provides several facilities to work with integers. To use, one has to include <elm/int.h>.
This module provides reliable and OS-independent types to represent integers together with a list of efficiently-implemented functions to process them. These types are stored in the elm::t
sub-namespace and, if you are using the elm
namespace, are quickly accessed by syntax t::type
.
Signed 16-bit integer type.
Signed 32-bit integer type.
Signed 64-bit integer type.
Signed 8-bit integer type.
Integer sufficiently big to store a pointer (according to the system configuration).
Integer type to represent memory offset (according to the system configuration).
Integer type to represent memory size (according to the system configuration).
Default size unsigned integer type.
Unsigned 16-bit integer type.
Unsigned 32-bit integer type.
Unsigned 64-bit integer type.
Unsigned 8-bit integer type.
t::uint32 elm::leastUpperPowerOf2 | ( | t::uint32 | v | ) |
Get the least upper power of 2 for the given value. If the value is a power of two, return it else compute the least greater power.
v | Value to process. |
References elm::msb().
Referenced by elm::stree::Builder< K, T, C >::allocate().
t::uint64 elm::leastUpperPowerOf2 | ( | t::uint64 | v | ) |
Get the least upper power of 2 for the given value. If the value is a power of two, return it else compute the least greater power.
v | Value to process. |
References elm::msb().
int elm::msb | ( | t::uint32 | i | ) |
Compute the position of the left-most bit to one.
i | Integer to test. |
Referenced by elm::leastUpperPowerOf2(), and elm::msb().
int elm::msb | ( | t::uint64 | i | ) |
Compute the position of the left-most bit to one.
i | Integer to test. |
References elm::msb().
t::uint32 elm::mult | ( | t::uint32 | a, |
t::uint32 | b, | ||
bool & | over | ||
) |
Perform multiplication on unsigned integer 32-bits.
a | First number to multiply. |
b | Second number to multiply. |
over | Set to true if overflow occurs. |
t::uint64 elm::mult | ( | t::uint64 | a, |
t::uint64 | b, | ||
bool & | over | ||
) |
Perform multiplication on unsigned integer 64-bits.
a | First number to multiply. |
b | Second number to multiply. |
over | Set to true if overflow occurs. |
int elm::ones | ( | t::uint8 | i | ) |
Count the number of ones in the given byte.
i | Byte to count ones in. |
Referenced by elm::WAHVector::countOnes(), elm::BitVector::countOnes(), and elm::ones().
int elm::ones | ( | t::uint16 | i | ) |
Count the number of ones in the given half-word.
i | Half-word to count ones in. |
References elm::ones().
int elm::ones | ( | t::uint64 | i | ) |
Count the number of ones in the given double-word.
i | Double-word to count ones in. |
References elm::ones().
t::uint32 elm::rounddown | ( | t::uint32 | v, |
t::uint32 | m | ||
) |
Round upto upper multiple integer
v | Value to round. |
m | Multiple to round with. |
t::uint32 elm::roundup | ( | t::uint32 | v, |
t::uint32 | m | ||
) |
Round upto upper multiple integer
v | Value to round. |
m | Multiple to round with. |