=false to bits - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: =false to bits (
/showthread.php?tid=581976)
=false to bits -
Su37Erich - 17.07.2015
Hello
I finally decided to work with bits instead of packed strings (something like this: [10 char]), because its a big waste of memory (By the way the hell about pawn normal strings, 4 bytes, BIG waste of memory...)
Now the problem is, when I was reading this tutorial:
https://sampforum.blast.hk/showthread.php?tid=177523 I found that the most significant bit isn't turned to 0 if is 1 when you use the operator ~.
Код:
//Here is my 'bit = false':
new variable = 0;
#define CONSTANT 0b00000000000000000000000000000001
variable &= ~CONSTANT;
/*~CONSTANT = 0b01111111111111111111111111111110 <- Here the problem, should be 0b11111111111111111111111111111110
Using now & with the variable -> 0b00000000000000000000000000000000
The result is equal to: 0b00000000000000000000000000000000 so I turned the last bit to 0 yeah, same as = false
*/
I know the first bit (most significant bit) is the sign but I don't want use a
signed cell?, there is a way of use this first bit? I don't want waste a bit

Thanks in advance!