mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Switch to holding the SIB as a typed ScaleIndexBase.
(and permit copy assignment)
This commit is contained in:
parent
75d2d64e7c
commit
63d8a88e2f
@ -146,7 +146,7 @@ class Decoder {
|
|||||||
uint64_t inward_data_ = 0;
|
uint64_t inward_data_ = 0;
|
||||||
|
|
||||||
// Indirection style.
|
// Indirection style.
|
||||||
uint8_t sib_;
|
ScaleIndexBase sib_;
|
||||||
|
|
||||||
// Facts about the instruction.
|
// Facts about the instruction.
|
||||||
int displacement_size_ = 0; // i.e. size of in-stream displacement, if any.
|
int displacement_size_ = 0; // i.e. size of in-stream displacement, if any.
|
||||||
|
@ -364,6 +364,7 @@ enum class Repetition: uint8_t {
|
|||||||
/// even though it is a superset of that supported prior to the 80386.
|
/// even though it is a superset of that supported prior to the 80386.
|
||||||
class ScaleIndexBase {
|
class ScaleIndexBase {
|
||||||
public:
|
public:
|
||||||
|
ScaleIndexBase() {}
|
||||||
ScaleIndexBase(uint8_t sib) : sib_(sib) {}
|
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))) {}
|
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:
|
private:
|
||||||
// Data is stored directly as an 80386 SIB byte.
|
// 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(sizeof(ScaleIndexBase) == 1);
|
||||||
static_assert(alignof(ScaleIndexBase) == 1);
|
static_assert(alignof(ScaleIndexBase) == 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user