Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob/src (SQLDataSerialization.cpp): msg#00190

db.carob.cvs

Subject: CVS update of carob/src (SQLDataSerialization.cpp)

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo