X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/126eb09b0fba38132b6b87844e4b12c57649e9e6..678d9f2a42faa84cf934bbb75a5b4414a094012e:/src/common/extended.c?ds=inline diff --git a/src/common/extended.c b/src/common/extended.c index a59607f14c..42225997a2 100644 --- a/src/common/extended.c +++ b/src/common/extended.c @@ -82,16 +82,25 @@ void ConvertToIeeeExtended(double num, unsigned char *bytes) } } - bytes[0] = expon >> 8; - bytes[1] = expon; - bytes[2] = (unsigned char) hiMant >> 24; - bytes[3] = (unsigned char) hiMant >> 16; - bytes[4] = (unsigned char) hiMant >> 8; - bytes[5] = (unsigned char) hiMant; - bytes[6] = (unsigned char) loMant >> 24; - bytes[7] = (unsigned char) loMant >> 16; - bytes[8] = (unsigned char) loMant >> 8; - bytes[9] = (unsigned char) loMant; + /* disable the warning about 'possible loss of data' */ + #ifdef _MSC_VER + #pragma warning(disable: 4244) + #endif /* Visual C++ */ + + bytes[0] = (expon >> 8) & 0xff; + bytes[1] = expon & 0xff; + bytes[2] = (unsigned char) ((hiMant >> 24) & 0xff); + bytes[3] = (unsigned char) ((hiMant >> 16) & 0xff); + bytes[4] = (unsigned char) ((hiMant >> 8) & 0xff); + bytes[5] = (unsigned char) (hiMant & 0xff); + bytes[6] = (unsigned char) ((loMant >> 24) & 0xff); + bytes[7] = (unsigned char) ((loMant >> 16) & 0xff); + bytes[8] = (unsigned char) ((loMant >> 8) & 0xff); + bytes[9] = (unsigned char) (loMant & 0xff); + + #ifdef _MSC_VER + #pragma warning(default: 4244) + #endif /* Visual C++ */ } /* @@ -176,4 +185,4 @@ double ConvertFromIeeeExtended(const unsigned char *bytes) return f; } -#endif // wxUSE_APPLE_IEEE +#endif /* wxUSE_APPLE_IEEE */