about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMaxwell Bernstein <emacs@fb.com>2020-10-22 13:21:07 -0700
committerMaxwell Bernstein <emacs@fb.com>2020-10-22 13:21:07 -0700
commitcff2cd82c2ea564003d5e4906cf701724772064d (patch)
treee5d257e0ece7eb576d38d5dde208de51a7d679ad
parentc82d149b3f92cccdbaa054e7ee4ecb814b523fec (diff)
downloadmu-cff2cd82c2ea564003d5e4906cf701724772064d.tar.gz
Use size-specific MAX/MIN constants
Don't rely on platform sizes.
-rw-r--r--013direct_addressing.cc4
-rw-r--r--014indirect_addressing.cc2
2 files changed, 3 insertions, 3 deletions
diff --git a/013direct_addressing.cc b/013direct_addressing.cc
index ee0b11fc..cbdc25a8 100644
--- a/013direct_addressing.cc
+++ b/013direct_addressing.cc
@@ -61,7 +61,7 @@ void test_add_r32_to_r32_signed_overflow() {
 }
 
 void test_add_r32_to_r32_unsigned_overflow() {
-  Reg[EAX].u = UINT_MAX;
+  Reg[EAX].u = UINT32_MAX;
   Reg[EBX].u = 1;
   run(
       "== code 0x1\n"  // code segment
@@ -374,7 +374,7 @@ case 3: {  // negate r/m32
 :(code)
 // negate can overflow in exactly one situation
 void test_negate_can_overflow() {
-  Reg[EBX].i = 0x80000000;  // INT_MIN
+  Reg[EBX].i = INT32_MIN;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
diff --git a/014indirect_addressing.cc b/014indirect_addressing.cc
index 36b680ca..7df0aae3 100644
--- a/014indirect_addressing.cc
+++ b/014indirect_addressing.cc
@@ -99,7 +99,7 @@ void test_add_mem_at_rm32_to_r32_signed_overflow() {
 
 void test_add_mem_at_rm32_to_r32_unsigned_overflow() {
   Reg[EAX].u = 0x2000;
-  Reg[EBX].u = UINT_MAX;
+  Reg[EBX].u = UINT32_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate