in reply to -1 from hex ffffffffffffffff ?
$ perl -e"print unpack('q',pack('H*', 'ffffffffffffffff'))" -1
See pack (and Two's complement for background).
(The 'q' stands for a 64-bit value, but you'd also get -1 for any other signed int of shorter length, such as 'l' (32-bit), 's' (16-bit), 'c' (8-bit) — in which case only part of the bit pattern would be used in the unpack...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: -1 from hex ffffffffffffffff ?
by ikegami (Patriarch) on Oct 02, 2009 at 16:59 UTC | |
by almut (Canon) on Oct 02, 2009 at 17:24 UTC | |
by ikegami (Patriarch) on Oct 02, 2009 at 18:08 UTC | |
by almut (Canon) on Oct 02, 2009 at 19:04 UTC | |
by ikegami (Patriarch) on Oct 02, 2009 at 19:24 UTC | |
| |
|
Re^2: -1 from hex ffffffffffffffff ?
by Spooky (Beadle) on Oct 02, 2009 at 16:11 UTC |