Date: Thursday, January 26, 2006 @ 17:30:24
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: SQLDataSerialization.cpp (1.21 -> 1.22)

full & simplified comparison now using std::string in floats_little_endianness()


--------------------------+
 SQLDataSerialization.cpp |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)


Index: carob/src/SQLDataSerialization.cpp
diff -u carob/src/SQLDataSerialization.cpp:1.21 
carob/src/SQLDataSerialization.cpp:1.22
--- carob/src/SQLDataSerialization.cpp:1.21     Thu Jan 26 17:23:36 2006
+++ carob/src/SQLDataSerialization.cpp  Thu Jan 26 17:30:24 2006
@@ -335,11 +335,9 @@
     // insert a '1' in the digit before the last
     float e125fbis_ = e125f_ + e125f_ / (1 << 22);
 
-    const uint32_t e125f = F2I(e125f_);
-    const uint32_t e125fbis = F2I(e125fbis_);
-
+    const uint32_t e125f = F2I(e125fbis_);
     const char *e125f_uc = reinterpret_cast<const char*>(&e125f);
-    const char *e125fbis_uc = reinterpret_cast<const char*>(&e125fbis);
+
 
     // build some magical double constants
 
@@ -350,27 +348,27 @@
     // insert a '1' in the digit before the last
     double e1007dbis_ = e1007d_ + e1007d_ / ((uint64_t) 1 << 51);
 
-    const uint64_t e1007d = D2I(e1007d_);
-    const uint64_t e1007dbis = D2I(e1007dbis_);
-
+    const uint64_t e1007d = D2I(e1007dbis_);
     const char *e1007d_uc = reinterpret_cast<const char*>(&e1007d);
-    const char *e1007dbis_uc = reinterpret_cast<const char*>(&e1007dbis);
 
+    using std::string;
     // then check if we have an classical MSB-float arch
     // (sign, exponent, fraction)
     // UNTESTED
-    if (e125f_uc[0] == 1
-        && e125fbis_uc[3] == 2
-        && e1007d_uc[0] == 1
-        && e1007dbis_uc[7] == 2)
+    const char e125f_msbf[] = { 1, 0, 0, 2 };
+    const char e1007d_msbf[] = { 1, 0, 0, 0, 0, 0, 0, 2 };
+    
+    if (string(e125f_uc, 4) == string(e125f_msbf, 4)
+        && string(e1007d_uc, 8) == string(e1007d_msbf, 8))
         return false;
 
     // else check if we have an classical LSB-float arch
     // TESTED (on IA32)
-    if (e125f_uc[3] == 1
-        && e125fbis_uc[0] == 2
-        && e1007d_uc[7] == 1
-        && e1007dbis_uc[0] == 2)
+    const char e125f_lsbf[] = { 2, 0, 0, 1 };
+    const char e1007d_lsbf[] = { 2, 0, 0, 0, 0, 0, 0, 1 };
+    
+    if (string(e125f_uc, 4) == string(e125f_lsbf, 4)
+        && string(e1007d_uc, 8) == string(e1007d_lsbf, 8))
         return true;
 
     // else weird unsupported arch, abort

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to