|
libmicroemu 0.2.0
ARM Microcontroller Emulator Library
|
Static Public Member Functions | |
| template<T alignment> | |
| static constexpr T | AlignDown (const T &address) |
| Aligns the given address down to the nearest multiple of the specified alignment. | |
| template<T alignment> | |
| static constexpr T | AlignUp (const T &address) |
| Aligns the given address up to the nearest multiple of the specified alignment. | |
| template<unsigned bit> | |
| static constexpr T | GenerateBitMask () |
| Generates a mask for the bit 'bit'. | |
| template<unsigned last_bit, unsigned first_bit> | |
| static constexpr T | GenerateBitMask () |
| Generates a mask of 1 bits in the region [last_bit:first_bit]. | |
| static constexpr T | GenerateBitMask (unsigned last_bit, unsigned first_bit) |
| Generates a mask of 1 bits in the region [last_bit:first_bit]. | |
| template<unsigned bit> | |
| static constexpr T | IsolateBit (const T &value) |
| Isolates the given bit "bit" in the value. | |
| template<unsigned bit> | |
| static constexpr bool | IsBitSet (const T &value) |
| Checks if the given bit "bit" is set in the value. | |
| template<unsigned last_bit, unsigned first_bit> | |
| static constexpr T | ExtractBits1R (const T &value) |
| Extracts bits from value in the region [last_bit:first_bit]. | |
| template<typename U> | |
| static U | ExtractType (T value, u32 start_byte) |
| Extracts bits from an value and returns the result as the specified type. | |
| template<typename U> | |
| static T | InsertType (T value, u32 start_byte, U insert_val) |
| Inserts bits of a shorter type into a value at the specified byte position. | |
| template<unsigned r2_last_bit, unsigned r2_first_bit, unsigned r1_last_bit, unsigned r1_first_bit> | |
| static constexpr T | ExtractBits2R (const T &value) |
| Extracts bits from value in 2 bit regions and concatenates them. | |
| template<typename U> | |
| static U | ZeroExtend (const T &value) |
| Takes a value of type T and converts it to type U by extending the missing bits with 0. | |
| template<typename U, unsigned top_bit> | |
| static U | SignExtend (const T &value) |
| Takes a value of type T and converts it to type U by extending the given top bit. | |
| static T | IsZeroBit (const T &value) |
| Checks if the given value is zero. | |
| static T | BitCount (const T &value) |
| Counts the number of bits set in the given value. | |
| static T | LowestBitSet (const T &value) |
| Finds the position of the lowest bit set in the given value. | |
| static T | CountLeadingZeros (const T &value) |
|
inlinestaticconstexpr |
Aligns the given address down to the nearest multiple of the specified alignment.
This function takes an address and aligns it downwards to the nearest multiple of the alignment. If the alignment is 0, it simply returns the original address.
| alignment | The alignment value, must be a power of 2. |
| T | The type of the address, typically an integer type. |
| address | The address to be aligned. |
|
inlinestaticconstexpr |
Aligns the given address up to the nearest multiple of the specified alignment.
This function takes an address and aligns it upwards to the nearest multiple of the alignment. If the alignment is 0, it simply returns the original address.
| alignment | The alignment value, must be a power of 2. |
| T | The type of the address, typically an integer type. |
| address | The address to be aligned. |
|
inlinestatic |
Counts the number of bits set in the given value.
| value | The value to count the bits. |
|
inlinestaticconstexpr |
Extracts bits from value in the region [last_bit:first_bit].
| last_bit | The last bit position. |
| first_bit | The first bit position. |
| value | The value to extract bits from. |
|
inlinestaticconstexpr |
Extracts bits from value in 2 bit regions and concatenates them.
| r2_last_bit | The last bit position of the second region. |
| r2_first_bit | The first bit position of the second region. |
| r1_last_bit | The last bit position of the first region. |
| r1_first_bit | The first bit position of the first region. |
| value | The value to extract bits from. |
|
inlinestatic |
Extracts bits from an value and returns the result as the specified type.
This function takes an value and extracts bits starting from the specified byte position. The extracted bits are then casted to the specified type and returned.
| U | The type to cast the extracted bits to. |
| value | The value to extract bits from. |
| start_byte | The starting byte position of the bits to extract. |
|
inlinestaticconstexpr |
Generates a mask for the bit 'bit'.
| bit | The bit position. |
|
inlinestaticconstexpr |
Generates a mask of 1 bits in the region [last_bit:first_bit].
| last_bit | The last bit position. |
| first_bit | The first bit position. |
|
inlinestaticconstexpr |
Generates a mask of 1 bits in the region [last_bit:first_bit].
| last_bit | The last bit position. |
| first_bit | The first bit position. |
|
inlinestatic |
Inserts bits of a shorter type into a value at the specified byte position.
| U | The type of the bits to insert. |
| value | The value to insert the bits into. |
| start_byte | The starting byte position to insert the value. |
| insert_val | The value of the type to be inserted. |
|
inlinestaticconstexpr |
Checks if the given bit "bit" is set in the value.
| bit | The bit position. |
| value | The value to check. |
|
inlinestaticconstexpr |
Isolates the given bit "bit" in the value.
| bit | The bit position. |
| value | The value to isolate the bit from. |
|
inlinestatic |
Checks if the given value is zero.
| value | The value to check. |
|
inlinestatic |
Finds the position of the lowest bit set in the given value.
| value | The value to find the lowest bit set. |
|
inlinestatic |
Takes a value of type T and converts it to type U by extending the given top bit.
| U | The type to convert to. |
| top_bit | The top bit position. |
| value | The value to convert. |
|
inlinestatic |
Takes a value of type T and converts it to type U by extending the missing bits with 0.
| U | The type to convert to. |
| value | The value to convert. |