1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Switch to holding the SIB as a typed ScaleIndexBase.

(and permit copy assignment)
This commit is contained in:
Thomas Harte 2022-02-20 17:54:53 -05:00
parent 75d2d64e7c
commit 63d8a88e2f
2 changed files with 3 additions and 2 deletions

View File

@ -146,7 +146,7 @@ class Decoder {
uint64_t inward_data_ = 0;
// Indirection style.
uint8_t sib_;
ScaleIndexBase sib_;
// Facts about the instruction.
int displacement_size_ = 0; // i.e. size of in-stream displacement, if any.

View File

@ -364,6 +364,7 @@ enum class Repetition: uint8_t {
/// even though it is a superset of that supported prior to the 80386.
class ScaleIndexBase {
public:
ScaleIndexBase() {}
ScaleIndexBase(uint8_t sib) : sib_(sib) {}
ScaleIndexBase(int scale, Source index, Source base) : sib_(uint8_t(scale << 6 | (int(index != Source::None ? index : Source::eSI) << 3) | int(base))) {}
@ -388,7 +389,7 @@ class ScaleIndexBase {
private:
// Data is stored directly as an 80386 SIB byte.
const uint8_t sib_ = 0;
uint8_t sib_ = 0;
};
static_assert(sizeof(ScaleIndexBase) == 1);
static_assert(alignof(ScaleIndexBase) == 1);