imm: Add additional bit position checks to Imm::Bits
This commit is contained in:
parent
be907a61f7
commit
6c9c829a08
1 changed files with 2 additions and 1 deletions
|
@ -46,6 +46,7 @@ public:
|
||||||
|
|
||||||
template <size_t begin_bit, size_t end_bit, typename T = u32>
|
template <size_t begin_bit, size_t end_bit, typename T = u32>
|
||||||
T Bits() const {
|
T Bits() const {
|
||||||
|
static_assert(begin_bit <= end_bit && end_bit < bit_size);
|
||||||
static_assert(Common::BitSize<T>() >= end_bit - begin_bit + 1);
|
static_assert(Common::BitSize<T>() >= end_bit - begin_bit + 1);
|
||||||
return static_cast<T>(Common::Bits<begin_bit, end_bit>(value));
|
return static_cast<T>(Common::Bits<begin_bit, end_bit>(value));
|
||||||
}
|
}
|
||||||
|
@ -87,7 +88,7 @@ bool operator!=(const Imm<bit_size>& a, u32 b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concatentate immediates together.
|
* Concatentate immediates together.
|
||||||
* Left to right correpeonds to most significant imm to least significant imm.
|
* Left to right corresponds to most significant imm to least significant imm.
|
||||||
* This is equivalent to a:b:...:z in ASL.
|
* This is equivalent to a:b:...:z in ASL.
|
||||||
*/
|
*/
|
||||||
template <size_t first_bit_size, size_t ...rest_bit_sizes>
|
template <size_t first_bit_size, size_t ...rest_bit_sizes>
|
||||||
|
|
Loading…
Reference in a new issue