about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMaxwell Bernstein <tekknolagi@gmail.com>2018-07-26 11:08:36 -0700
committerMaxwell Bernstein <tekknolagi@gmail.com>2018-07-26 11:08:36 -0700
commitfd06455396f5acb9f43b703652eaff904913db87 (patch)
tree308a9a53656aecdaa991b62af1801c09f7f3cff5
parentd2571b69b17c65380347d4b669ab51ff0ea6eebc (diff)
downloadmu-fd06455396f5acb9f43b703652eaff904913db87.tar.gz
Use semicolons instead of commas for sequencing
-rw-r--r--subx/024pack_instructions.cc42
1 files changed, 28 insertions, 14 deletions
diff --git a/subx/024pack_instructions.cc b/subx/024pack_instructions.cc
index 92e557ae..bb63cb00 100644
--- a/subx/024pack_instructions.cc
+++ b/subx/024pack_instructions.cc
@@ -80,14 +80,22 @@ void add_modrm_byte(const line& in, line& out) {
   bool emit = false;
   for (int i = 0;  i < SIZE(in.words);  ++i) {
     const word& curr = in.words.at(i);
-    if (has_metadata(curr, "mod"))
-      mod = hex_byte(curr.data), emit = true;
-    else if (has_metadata(curr, "rm32"))
-      rm32 = hex_byte(curr.data), emit = true;
-    else if (has_metadata(curr, "r32"))
-      reg_subop = hex_byte(curr.data), emit = true;
-    else if (has_metadata(curr, "subop"))
-      reg_subop = hex_byte(curr.data), emit = true;
+    if (has_metadata(curr, "mod")) {
+      mod = hex_byte(curr.data);
+      emit = true;
+    }
+    else if (has_metadata(curr, "rm32")) {
+      rm32 = hex_byte(curr.data);
+      emit = true;
+    }
+    else if (has_metadata(curr, "r32")) {
+      reg_subop = hex_byte(curr.data);
+      emit = true;
+    }
+    else if (has_metadata(curr, "subop")) {
+      reg_subop = hex_byte(curr.data);
+      emit = true;
+    }
   }
   if (emit)
     out.words.push_back(hex_byte_text((mod << 6) | (reg_subop << 3) | rm32));
@@ -98,12 +106,18 @@ void add_sib_byte(const line& in, line& out) {
   bool emit = false;
   for (int i = 0;  i < SIZE(in.words);  ++i) {
     const word& curr = in.words.at(i);
-    if (has_metadata(curr, "scale"))
-      scale = hex_byte(curr.data), emit = true;
-    else if (has_metadata(curr, "index"))
-      index = hex_byte(curr.data), emit = true;
-    else if (has_metadata(curr, "base"))
-      base = hex_byte(curr.data), emit = true;
+    if (has_metadata(curr, "scale")) {
+      scale = hex_byte(curr.data);
+      emit = true;
+    }
+    else if (has_metadata(curr, "index")) {
+      index = hex_byte(curr.data);
+      emit = true;
+    }
+    else if (has_metadata(curr, "base")) {
+      base = hex_byte(curr.data);
+      emit = true;
+    }
   }
   if (emit)
     out.words.push_back(hex_byte_text((scale << 6) | (index << 3) | base));