1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-03 12:21:20 +00:00

Merge pull request #108 from QB64Cobalt/development

Corrections to Bit Routines to allow for unsigned integer64 values
This commit is contained in:
Fellippe Heitor 2019-12-08 11:55:14 -03:00 committed by GitHub
commit c848e0d40e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 23 deletions

View file

@ -641,12 +641,12 @@ extern float string2s(qbs*str);
extern double string2d(qbs*str);
extern long double string2f(qbs*str);
//Cobalt(aka Dave) added the next 2 lines
int64 func__shr(int64 a1, int b1);
int64 func__shl(int64 a1, int b1);
int64 func__readbit(int64 a1, int b1);
int64 func__setbit(int64 a1, int b1);
int64 func__resetbit(int64 a1, int b1);
int64 func__togglebit(int64 a1, int b1);
uint64 func__shr(uint64 a1, int b1);
uint64 func__shl(uint64 a1, int b1);
int64 func__readbit(uint64 a1, int b1);
uint64 func__setbit(uint64 a1, int b1);
uint64 func__resetbit(uint64 a1, int b1);
uint64 func__togglebit(uint64 a1, int b1);
#ifndef QB64_WINDOWS
extern void Sleep(uint32 milliseconds);
extern void ZeroMemory(void *ptr,int64 bytes);
@ -975,22 +975,22 @@ inline int32 func_sgn(long double v){
}
//bit-shifting
inline int64 func__shl(int64 a1,int b1)
inline uint64 func__shl(uint64 a1,int b1)
{return a1<<b1;}
inline int64 func__shr(int64 a1,int b1)
inline uint64 func__shr(uint64 a1,int b1)
{return a1>>b1;}
inline int64 func__readbit(int64 a1, int b1)
inline int64 func__readbit(uint64 a1, int b1)
{if (a1 & 1ull<<b1) return -1; else return 0;}
inline int64 func__setbit(int64 a1, int b1)
inline uint64 func__setbit(uint64 a1, int b1)
{return a1 | 1ull<<b1;}
inline int64 func__resetbit(int64 a1, int b1)
inline uint64 func__resetbit(uint64 a1, int b1)
{return a1 & ~(1ull<<b1);}
inline int64 func__togglebit(int64 a1, int b1)
inline uint64 func__togglebit(uint64 a1, int b1)
{return a1 ^ 1ull<<b1;}
//Working with 32bit colors:

View file

@ -3268,8 +3268,8 @@ id.n = "_SHR"
id.subfunc = 1
id.callname = "func__shr"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3277,8 +3277,8 @@ id.n = "_SHL"
id.subfunc = 1
id.callname = "func__shl"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3413,7 +3413,7 @@ id.n = "_READBIT"
id.subfunc = 1
id.callname = "func__readbit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
regid
@ -3422,8 +3422,8 @@ id.n = "_SETBIT"
id.subfunc = 1
id.callname = "func__setbit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3431,8 +3431,8 @@ id.n = "_RESETBIT"
id.subfunc = 1
id.callname = "func__resetbit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3440,6 +3440,6 @@ id.n = "_TOGGLEBIT"
id.subfunc = 1
id.callname = "func__togglebit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid