[llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Jan 28 10:47:44 PST 2006



Changes in directory llvm/lib/Target/X86:

X86Subtarget.cpp updated: 1.18 -> 1.19
---
Log message:

Use union instead of reinterpret_cast.

---
Diffs of the changes:  (+9 -5)

 X86Subtarget.cpp |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/X86/X86Subtarget.cpp
diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.18 llvm/lib/Target/X86/X86Subtarget.cpp:1.19
--- llvm/lib/Target/X86/X86Subtarget.cpp:1.18	Sat Jan 28 12:38:20 2006
+++ llvm/lib/Target/X86/X86Subtarget.cpp	Sat Jan 28 12:47:32 2006
@@ -67,11 +67,15 @@
   GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
   bool Em64T = EDX & (1 << 29);
 
-  unsigned text[12];
-  GetCpuIDAndInfo(0x80000002, text+0, text+1, text+2, text+3);
-  GetCpuIDAndInfo(0x80000003, text+4, text+5, text+6, text+7);
-  GetCpuIDAndInfo(0x80000004, text+8, text+9, text+10, text+11);
-  char *t = reinterpret_cast<char *>(&text[0]);
+  union {
+    unsigned u[12];
+    char     c[48];
+  } text;
+
+  GetCpuIDAndInfo(0x80000002, text.u+0, text.u+1, text.u+2, text.u+3);
+  GetCpuIDAndInfo(0x80000003, text.u+4, text.u+5, text.u+6, text.u+7);
+  GetCpuIDAndInfo(0x80000004, text.u+8, text.u+9, text.u+10, text.u+11);
+  char *t = text.c;
   while (*t == ' ')
 	  t++;
 






More information about the llvm-commits mailing list