From 8abc34c99e4e4b12eb05888fca556b45cf03f937 Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Mon, 17 Aug 2015 21:53:35 +1000 Subject: [PATCH] Explicitly declare a large integer in qbr() routines to be unsigned, thus averting compiler warning. --- internal/c/common.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/c/common.cpp b/internal/c/common.cpp index 9f4e1baab..3edf5d407 100644 --- a/internal/c/common.cpp +++ b/internal/c/common.cpp @@ -235,7 +235,7 @@ inline int64 qbr(long double f){ int64 i; int temp=0; if (f<=-9223372036854775808.5) {error(6); return 0;} // if the float is smaller than what an integer 64 could possible hold, toss an overflow error. if (f>=18446744073709551615.5) {error(6); return 0;} // same result if the number is larger than what an integer 64 could possibly hold. - if (f>9223372036854775807) {temp=1;f=f-9223372036854775808;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible. + if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible. if (f<0) i=f-0.5f; else i=f+0.5f; if (temp) return i|0x8000000000000000;//+9223372036854775808; return i; @@ -250,7 +250,7 @@ inline int64 qbr(long double f){ int64 i; int temp=0; if (f<=-9223372036854775808.5) {error(6); return 0;} // if the float is smaller than what an integer 64 could possible hold, toss an overflow error. if (f>=18446744073709551615.5) {error(6); return 0;} // same result if the number is larger than what an integer 64 could possibly hold. - if (f>9223372036854775807) {temp=1;f=f-9223372036854775808;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible. + if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible. __asm{ fld f fistp i @@ -290,7 +290,7 @@ inline int64 qbr(long double f){ int64 i; int temp=0; if (f<=-9223372036854775808.5) {error(6); return 0;} // if the float is smaller than what an integer 64 could possible hold, toss an overflow error. if (f>=18446744073709551615.5) {error(6); return 0;} // same result if the number is larger than what an integer 64 could possibly hold. - if (f>9223372036854775807) {temp=1;f=f-9223372036854775808;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible. + if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible. __asm__ ( "fldt %1;" "fistpll %0;"