From bb689179e373f3adf7fb1d006f7c9c03b49edb2f Mon Sep 17 00:00:00 2001 From: Andrea Zoli <zoli@iasfbo.inaf.it> Date: Tue, 15 Jul 2014 14:23:09 +0200 Subject: [PATCH] Fix 32bit compilation warnings. --- src/File.cpp | 2 +- src/PartOfPacket.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/File.cpp b/src/File.cpp index 6457625..a241079 100644 --- a/src/File.cpp +++ b/src/File.cpp @@ -222,7 +222,7 @@ long File::getpos() bool File::memBookmarkPos() { - if((bookmarkPos = ftell(fp)) != (dword) -1) + if((bookmarkPos = ftell(fp)) != -1) return true; else return false; diff --git a/src/PartOfPacket.cpp b/src/PartOfPacket.cpp index 7673ad3..1756cda 100644 --- a/src/PartOfPacket.cpp +++ b/src/PartOfPacket.cpp @@ -506,7 +506,7 @@ double PartOfPacket::getFieldValue_64f(word index) //TODO throw new PacketException("The getFieldValue_64f() does not work in a 32 bit operating system"); } - + union u_tag { /// 64 bit for 64 bit os) @@ -514,7 +514,11 @@ double PartOfPacket::getFieldValue_64f(word index) /// 64 bit double precision double d; } u; + +#ifdef __x86_64__ u.i = (unsigned long) ( (unsigned long) getFieldValue(index) << (48)) | ( (unsigned long) getFieldValue(index + 1) << (32)) | ( (unsigned long) getFieldValue(index + 2) << (16)) | ( (unsigned long) getFieldValue(index + 3) ); +#endif + return u.d; } @@ -541,7 +545,8 @@ void PartOfPacket::setFieldValue_64f(word index, double value) //TODO throw new PacketException("The getFieldValue_64f() does not work in a 32 bit operating system"); } - + +#if __x86_64__ union u_tag { /// 64 bit for 64 bit os) @@ -560,6 +565,7 @@ void PartOfPacket::setFieldValue_64f(word index, double value) setFieldValue(index + 2, w); w = (word)(0xFFFF & u.i); setFieldValue(index + 3, w); +#endif } signed long PartOfPacket::getFieldValue_32i(word index) -- GitLab