Created
July 26, 2011 08:31
-
-
Save cotto/1106278 to your computer and use it in GitHub Desktop.
fun with pack and unpack
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
perl -e 'print unpack("i", pack("i", -2315606021))."\n";' | |
x64: 1979361275 | |
x86: -2147483648 | |
perl -e 'print unpack("i", pack("i", -2315606022))."\n";' | |
x64: 1979361274 | |
x86: -2147483648 | |
What I need is something to chop off anything after 4 bytes. Actually, that's a lie. What I actually need is to know that the value will fit within the range of an int32. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment