mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-09 03:45:13 +00:00
Merge pull request #104 from QB64Cobalt/development
Added 4 New Bit Functions
This commit is contained in:
commit
5ff044b027
|
@ -643,6 +643,10 @@ extern long double string2f(qbs*str);
|
||||||
//Cobalt(aka Dave) added the next 2 lines
|
//Cobalt(aka Dave) added the next 2 lines
|
||||||
int64 func__shr(int64 a1, int b1);
|
int64 func__shr(int64 a1, int b1);
|
||||||
int64 func__shl(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);
|
||||||
#ifndef QB64_WINDOWS
|
#ifndef QB64_WINDOWS
|
||||||
extern void Sleep(uint32 milliseconds);
|
extern void Sleep(uint32 milliseconds);
|
||||||
extern void ZeroMemory(void *ptr,int64 bytes);
|
extern void ZeroMemory(void *ptr,int64 bytes);
|
||||||
|
@ -977,6 +981,18 @@ inline int64 func__shl(int64 a1,int b1)
|
||||||
inline int64 func__shr(int64 a1,int b1)
|
inline int64 func__shr(int64 a1,int b1)
|
||||||
{return a1>>b1;}
|
{return a1>>b1;}
|
||||||
|
|
||||||
|
inline int64 func__readbit(int64 a1, int b1)
|
||||||
|
{if (a1 & 1<<b1) return -1; else return 0;}
|
||||||
|
|
||||||
|
inline int64 func__setbit(int64 a1, int b1)
|
||||||
|
{return a1 | 1<<b1;}
|
||||||
|
|
||||||
|
inline int64 func__resetbit(int64 a1, int b1)
|
||||||
|
{return a1 & ~(1<<b1);}
|
||||||
|
|
||||||
|
inline int64 func__togglebit(int64 a1, int b1)
|
||||||
|
{return a1 ^ 1<<b1;}
|
||||||
|
|
||||||
//Working with 32bit colors:
|
//Working with 32bit colors:
|
||||||
inline uint32 func__rgb32(int32 r,int32 g,int32 b,int32 a){
|
inline uint32 func__rgb32(int32 r,int32 g,int32 b,int32 a){
|
||||||
if (r<0) r=0;
|
if (r<0) r=0;
|
||||||
|
|
|
@ -3407,3 +3407,39 @@ id.callname = "func__getconsoleinput"
|
||||||
id.args = 0
|
id.args = 0
|
||||||
id.ret = LONGTYPE - ISPOINTER
|
id.ret = LONGTYPE - ISPOINTER
|
||||||
regid
|
regid
|
||||||
|
|
||||||
|
clearid
|
||||||
|
id.n = "_READBIT"
|
||||||
|
id.subfunc = 1
|
||||||
|
id.callname = "func__readbit"
|
||||||
|
id.args = 2
|
||||||
|
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
|
||||||
|
id.ret = INTEGER64TYPE - ISPOINTER
|
||||||
|
regid
|
||||||
|
|
||||||
|
clearid
|
||||||
|
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
|
||||||
|
regid
|
||||||
|
|
||||||
|
clearid
|
||||||
|
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
|
||||||
|
regid
|
||||||
|
|
||||||
|
clearid
|
||||||
|
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
|
||||||
|
regid
|
||||||
|
|
Loading…
Reference in a new issue