mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-08 05:35:16 +00:00
Stop qbr() doing range checking, which is more inline with the rest of QB64.
This commit is contained in:
parent
5313c87e4d
commit
2f21ad352c
|
@ -233,13 +233,9 @@ struct img_struct{
|
||||||
#define IMG_SCREEN 2 //img is linked to other screen pages
|
#define IMG_SCREEN 2 //img is linked to other screen pages
|
||||||
#define IMG_FREEMEM 4 //if set, it means memory must be freed
|
#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
|
#ifdef QB64_NOT_X86
|
||||||
inline int64 qbr(long double f){
|
inline int64 qbr(long double f){
|
||||||
int64 i; int temp=0;
|
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>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 (f<0) i=f-0.5f; else i=f+0.5f;
|
||||||
if (temp) return i|0x8000000000000000;//+9223372036854775808;
|
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
|
#ifdef QB64_MICROSOFT
|
||||||
inline int64 qbr(long double f){
|
inline int64 qbr(long double f){
|
||||||
int64 i; int temp=0;
|
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>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{
|
__asm{
|
||||||
fld f
|
fld f
|
||||||
|
@ -293,8 +287,6 @@ inline int32 qbr_double_to_long(double f){
|
||||||
//FLDT=load long double
|
//FLDT=load long double
|
||||||
inline int64 qbr(long double f){
|
inline int64 qbr(long double f){
|
||||||
int64 i; int temp=0;
|
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>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__ (
|
__asm__ (
|
||||||
"fldt %1;"
|
"fldt %1;"
|
||||||
|
|
Loading…
Reference in a new issue