Skip to contentSkip to conversation

arch_init: Setting QEMU_ARCH enum straight

PATCH Superseded Bastian Koppelmann 2 participants 2 messages Sep 8, 2014 – Sep 15, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch_init: Setting QEMU_ARCH enum straight

Every QEMU_ARCH is now hexadecimal instead of a mixture of decimal and hexadecimal.

---
 include/sysemu/arch_init.h | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
include/sysemu/arch_init.h +15 -15
index 8939233..e1ec025 100644
@@ -5,21 +5,21 @@
 #include "qemu/option.h"
 
 enum {
-    QEMU_ARCH_ALL = -1,
-    QEMU_ARCH_ALPHA = 1,
-    QEMU_ARCH_ARM = 2,
-    QEMU_ARCH_CRIS = 4,
-    QEMU_ARCH_I386 = 8,
-    QEMU_ARCH_M68K = 16,
-    QEMU_ARCH_LM32 = 32,
-    QEMU_ARCH_MICROBLAZE = 64,
-    QEMU_ARCH_MIPS = 128,
-    QEMU_ARCH_PPC = 256,
-    QEMU_ARCH_S390X = 512,
-    QEMU_ARCH_SH4 = 1024,
-    QEMU_ARCH_SPARC = 2048,
-    QEMU_ARCH_XTENSA = 4096,
-    QEMU_ARCH_OPENRISC = 8192,
+    QEMU_ARCH_ALL = -0x1,
+    QEMU_ARCH_ALPHA = 0x1,
+    QEMU_ARCH_ARM = 0x2,
+    QEMU_ARCH_CRIS = 0x4,
+    QEMU_ARCH_I386 = 0x8,
+    QEMU_ARCH_M68K = 0x10,
+    QEMU_ARCH_LM32 = 0x20,
+    QEMU_ARCH_MICROBLAZE = 0x40,
+    QEMU_ARCH_MIPS = 0x80,
+    QEMU_ARCH_PPC = 0x100,
+    QEMU_ARCH_S390X = 0x200,
+    QEMU_ARCH_SH4 = 0x400,
+    QEMU_ARCH_SPARC = 0x800,
+    QEMU_ARCH_XTENSA = 0x1000,
+    QEMU_ARCH_OPENRISC = 0x2000,
     QEMU_ARCH_UNICORE32 = 0x4000,
     QEMU_ARCH_MOXIE = 0x8000,
     QEMU_ARCH_TRICORE = 0x10000,
Signature · 1 line
2.1.0
#1 lore raw
Quoted 1 line · Bastian Koppelmann

Every QEMU_ARCH is now hexadecimal instead of a mixture of decimal and hexadecimal.

I'm not sure it is worth the trouble really. For readability, the best in this case (in my opinion anyway) is to use (1<<n) notation (with consecutive n), so it becomes really obvious that these are distinct bits. Besides, -0x01 (fo ARCH_ALL) does look a bit weird :)

Thanks,

/mjt