What is bool vs 32 bit new?
#1

Ok, I for long time didn't use bool (i didn't really know what it is) and, so i remember, that i have saw in keys using about like this:
if(keys&KEY_WHATEVER)
So by having each key other number 2*2 (i don't know how it spells in english, maybe power) it allows to have 2 or more keys pressed working in time.
Last i want to say is that bool is 7 bit in ram, new is 32 bit, bool limits are 1 or 0, new limits are 2147483647, bool is faster but, can hold one 0 or 1,
new is slower, but can hold 31 0 or 1, so it's in right using is like 31 bool variables.
Here you can see my fast cmd that shows the usement of this:
new cmd[256];
new idx;
new tmp[256];
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/NT", true) ==0)
{
tmp=strtok(cmdtext, idx);
new thevar=strval(tmp);
new trs[128];
format(trs,128,"Binary : %b", thevar);
SendClientMessage(playerid,0xFFFFFFFF,trs);
new multi2=1;
for(new k;k<31;k++)
{
if(thevar&multi2)
{
format(trs,128,"Bit Offset : %d, Decimal Offset : %d, IS 1", k, multi2);
SendClientMessage(playerid,0xFFFFFFFF,trs);
}
else
{
format(trs,128,"Bit Offset : %d, Decimal Offset : %d, IS 0", k, multi2);
SendClientMessage(playerid,0xFFFFFFFF,trs);
}
multi2=multi2*2;
}
return 1;
}
So i want your knowledge about this? And what you think about this?
Reply
#2

Hey why noone says nothing?!
Reply
#3

Have you read this topic? These tricks were nicely explained there
Reply
#4

Oh, wHY i didn't know it before i thought this X@, agh....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)