17.07.2015, 00:50
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 ~.
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!
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 */
Thanks in advance!