=false to bits
#1

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)