Add support for bitwise not
Issue #382
new
Originally reported on Google Code with ID 382
There are bitwise AND, OR and Shift operators in the latest code, but no bitwise not.
The not function seems to be doing a 2's complement, not a straight toggle of bits.
E.g. not(0b101010) = -0b101011 (I am expecting 0b010101)
Can you please a ~ operator that simply toggles the bits, (like the C++ ~ operator)?
Thanks
Alan.
Reported by alan.n.davies
on 2011-07-05 13:44:25
Comments (8)
-
Account Deleted -
Account Deleted Except the binary representation of -43 (-x-1, where x==42) in c++ is different to the binary representation of -43 in Speed Crunch. ~42 in c++ results in 0b11111111111111111111111111010101 (pure bitwise not). not(42) in Speed Crunch gives -0b101011 (adds one to the number and puts a negative sign in front).
Reported by
alan.n.davies
on 2012-11-05 11:40:54 -
related to issue #562.
-
I agree with the OP, SC's behaviour is not really expected.
-
Account Deleted So is there going to be a solution for this in the near future? or are there a temporary fix for us lazy ass's who do not want to do a bitwise not ourselves
-
Well, you can do
mask(not(x); n)
. Heren
is the total number of bits you are considering. -
Account Deleted Yeah, I figured that out after I wrote that comment, but thanks anyway!
-
repo owner - Log in to comment
Reported by
helder.pereira.correia
on 2012-11-05 08:34:24