Date: Thursday, January 26, 2006 @ 17:23:36
Author: marc
Path: /cvsroot/carob/carob/src
Modified: SQLDataSerialization.cpp (1.20 -> 1.21)
full & simplified comparison now using std::string in ints_little_endianness()
--------------------------+
SQLDataSerialization.cpp | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
Index: carob/src/SQLDataSerialization.cpp
diff -u carob/src/SQLDataSerialization.cpp:1.20
carob/src/SQLDataSerialization.cpp:1.21
--- carob/src/SQLDataSerialization.cpp:1.20 Thu Jan 26 17:16:50 2006
+++ carob/src/SQLDataSerialization.cpp Thu Jan 26 17:23:36 2006
@@ -386,21 +386,24 @@
const char *i_uc = reinterpret_cast<const char*>(&I);
const char *l_uc = reinterpret_cast<const char*>(&L);
- // then check if we have an classical MSB-float arch
- // (sign, exponent, fraction)
+ using std::string;
+
+ // then check if we have an classical MSB arch
// UNTESTED
- if (i_uc[0] == 1
- && i_uc[3] == 2
- && l_uc[0] == 1
- && l_uc[7] == 2)
+ const char i_msbf[] = { 1, 0, 0, 2 };
+ const char l_msbf[] = { 1, 0, 0, 0, 0, 0, 0, 2 };
+
+ if (string(i_uc, 4) == string(i_msbf, 4)
+ && string(l_uc, 8) == string(l_msbf, 8))
return false;
- // else check if we have an classical LSB-float arch
+ // else check if we have an classical LSB arch
// TESTED (on IA32)
- if (i_uc[3] == 1
- && i_uc[0] == 2
- && l_uc[7] == 1
- && l_uc[0] == 2)
+ const char i_lsbf[] = { 2, 0, 0, 1 };
+ const char l_lsbf[] = { 2, 0, 0, 0, 0, 0, 0, 1 };
+
+ if (string(i_uc, 4) == string(i_lsbf, 4)
+ && string(l_uc, 8) == string(l_lsbf, 8))
return true;
// else weird unsupported arch, abort
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits