Last active
August 29, 2015 14:01
-
-
Save aar0nTw/ca1953f2502088499ab6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
length = 32 | |
mid = 2**(length-1) | |
max_unsigned = 2**length | |
to_signed = proc {|n| (n>=mid) ? n - max_unsigned : n} | |
p to_signed["0xFFF54006".to_i(16)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment