Add ~ as bitwise complement operator
While trying to calculate the 32-bit boundary of an image I discovered that speedcruch doesn't handle this type of math. I'm not sure if it's a bug or if it was never intended to do this.
((2550 * 8 + 31) & ~31)/8 = 1.875 //Should Be 2552
((2550 * 24 + 31) & ~31)/8 = 1.875 //Should Be 7652
((2550 * 32 + 31) & ~31)/8 = 3.875 //Should Be 10200
Comments (5)
-
-
Thanks for your report. The complement operator is
not
, the~
operator does not exist and is ignored.#! ((2550 * 8 + 31) & not 31)/8 = 2552 ((2550 * 24 + 31) & not 31)/8 = 7652 ((2550 * 32 + 31) & not 31)/8 = 10200
If you find it strange that the
~
character does not trigger any error, check #821.Maybe we should consider aliasing
~
tonot
, especially since~
appears on the bitfield widget. @heldercorreia What do you think about it? -
- changed title to Add ~ as bitwise complement operator
-
Thanks for the clarification. I saw
not
but wasn't sure how to use it and I wasn't sure ifLogical NOT
meant the same asBitwise NOT
. Adding~
would clear it up though. -
repo owner - Log in to comment
I should've said complement vs compliment when I created this issue. LOL. I figure this problem is due to have 2 operators & and ~ next to each other but I haven't looked at the code to understand how the parsing works. Thanks for the awesome calculator.