in reply to Casting numbers
You can replace ~$a with $a^0xffff (or $a^0xff for byte-wise bit negation).
- tye