ROSE 0.11.145.147
|
Information about alignments.
Definition at line 16 of file Alignment.h.
#include <Rose/BinaryAnalysis/Alignment.h>
Public Member Functions | |
Alignment () | |
Default constructor. | |
Alignment (uint64_t alignment, size_t nBits) | |
Constructor with specific alignment. | |
uint64_t | alignDown (uint64_t) const |
Round value down to closest multiple of the alignment. | |
Sawyer::Optional< uint64_t > | alignUp (uint64_t) const |
Round value up to the closest multiple of the alignment. | |
bool | isAligned (uint64_t) const |
Test whether a value is aligned. | |
Alignment & | operator= (const Alignment &)=default |
Assignment. | |
Alignment & | operator= (const uint64_t) |
Assignment. | |
uint64_t | get () const |
Property: Alignment. | |
uint64_t | operator* () const |
Property: Alignment. | |
void | set (uint64_t) |
Property: Alignment. | |
size_t | nBits () const |
Property: Number of bits in the values being aligned. | |
void | nBits (size_t) |
Property: Number of bits in the values being aligned. | |
Rose::BinaryAnalysis::Alignment::Alignment | ( | ) |
Default constructor.
The resulting object is not usable until the nBits property is set.
Rose::BinaryAnalysis::Alignment::Alignment | ( | uint64_t | alignment, |
size_t | nBits | ||
) |
Constructor with specific alignment.
The first argument is the alignment, and the second argument is the width in bits of the values to be aligned. An alignment of zero is the same as an alignment of one, and will be returned as one by get. The number of bits must be between eight and 64, inclusive.
size_t Rose::BinaryAnalysis::Alignment::nBits | ( | ) | const |
Property: Number of bits in the values being aligned.
This property is zero for default-constructed alignments. It can only be set to positive values between 8 and 64, inclusive.
void Rose::BinaryAnalysis::Alignment::nBits | ( | size_t | ) |
Property: Number of bits in the values being aligned.
This property is zero for default-constructed alignments. It can only be set to positive values between 8 and 64, inclusive.
uint64_t Rose::BinaryAnalysis::Alignment::alignDown | ( | uint64_t | ) | const |
Round value down to closest multiple of the alignment.
An exception is thrown if this alignment has zero width, such as when it is default constructed.
Sawyer::Optional< uint64_t > Rose::BinaryAnalysis::Alignment::alignUp | ( | uint64_t | ) | const |
Round value up to the closest multiple of the alignment.
If the value is equal to a multiple of the alignment then the value is returned unchanged, otherwise the value is incremented until it is a multiple of the alignment. If the next multiple of the alignment is too large to represent in the specified number of bits, then nothing is returned.
An exception is thrown if this alignment has zero width, such as when it is default constructed.
bool Rose::BinaryAnalysis::Alignment::isAligned | ( | uint64_t | ) | const |
Test whether a value is aligned.
An exception is thrown if this alignment has zero width, such as when it is default constructed.