Browse code

Fix of unit tests for big endian floating point

Steven Morgan authored on 2013/11/05 07:48:46
Showing 1 changed files
... ...
@@ -28,20 +28,20 @@ int get_fpu_endian(void)
28 28
 #ifdef _WIN32
29 29
   return FPU_ENDIAN_LITTLE;
30 30
 #else
31
-    char * fpu_le = "elleemme";
32
-    char * fpu_be = "emmeelle";
33
-    static union sd {
31
+    const char * fpu_le = "elleemme";
32
+    const char * fpu_be = "emmeelle";
33
+    const union sd {
34 34
         double d;
35 35
         char mem[8];
36 36
     } u_md = {3815911171354501045744583353695226502220105394563506259449467213186125718792664588210662403287568710818873279842508553551908601408568128557088985172985437412593385138085986771664896.0};
37 37
     if (!memcmp(u_md.mem, fpu_le, 8)) {
38 38
         cli_dbgmsg("fpu: Floating point little endian detected.\n");
39 39
         return FPU_ENDIAN_LITTLE;
40
-    } else if (!memcmp(u_md.mem, fpu_be, 8) == 0) {
40
+    } else if (!memcmp(u_md.mem, fpu_be, 8)) {
41 41
         cli_dbgmsg("fpu: Floating point big endian detected.\n");
42 42
         return FPU_ENDIAN_BIG;
43 43
     } else {
44
-        cli_dbgmsg("fpu: Floating point endian detection failed."
44
+        cli_dbgmsg("fpu: Floating point endian detection failed. "
45 45
                    "Bytes: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x \n",
46 46
                    u_md.mem[0], u_md.mem[1], u_md.mem[2], u_md.mem[3], 
47 47
                    u_md.mem[4], u_md.mem[5], u_md.mem[6], u_md.mem[7]);