ROSE 0.11.145.192
Public Member Functions | List of all members
Rose::BinaryAnalysis::Alignment Class Reference

Description

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.
 
Alignmentoperator= (const Alignment &)=default
 Assignment.
 
Alignmentoperator= (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.
 

Constructor & Destructor Documentation

◆ Alignment() [1/2]

Rose::BinaryAnalysis::Alignment::Alignment ( )

Default constructor.

The resulting object is not usable until the nBits property is set.

◆ Alignment() [2/2]

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.

Member Function Documentation

◆ nBits() [1/2]

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.

◆ nBits() [2/2]

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.

◆ alignDown()

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.

◆ alignUp()

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.

◆ isAligned()

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.


The documentation for this class was generated from the following file: