From 6c9c829a08b7099cea9baf7da7a59c793305bc29 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 8 Apr 2018 10:42:23 +0100 Subject: [PATCH] imm: Add additional bit position checks to Imm::Bits --- src/frontend/A64/imm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/frontend/A64/imm.h b/src/frontend/A64/imm.h index 23b4b71c..9b33ab2e 100644 --- a/src/frontend/A64/imm.h +++ b/src/frontend/A64/imm.h @@ -46,6 +46,7 @@ public: template T Bits() const { + static_assert(begin_bit <= end_bit && end_bit < bit_size); static_assert(Common::BitSize() >= end_bit - begin_bit + 1); return static_cast(Common::Bits(value)); } @@ -87,7 +88,7 @@ bool operator!=(const Imm& a, u32 b) { /** * 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. */ template