1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 07:40:24 +00:00

Stop qbr() doing range checking, which is more inline with the rest of QB64.

This commit is contained in:
Luke Ceddia 2016-08-08 09:45:28 +10:00
parent 5313c87e4d
commit 2f21ad352c

View file

@ -233,13 +233,9 @@ struct img_struct{
#define IMG_SCREEN 2 //img is linked to other screen pages
#define IMG_FREEMEM 4 //if set, it means memory must be freed
extern void error(int32 error_number); //declare the erorr handler so we can call it if needed.
#ifdef QB64_NOT_X86
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-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;
@ -253,8 +249,6 @@ inline int32 qbr_double_to_long(double f){if (f<0) return(f-0.5f); else return(f
#ifdef QB64_MICROSOFT
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-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
__asm{
fld f
@ -293,8 +287,6 @@ inline int32 qbr_double_to_long(double f){
//FLDT=load long double
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-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
__asm__ (
"fldt %1;"