shownum

shownum is a simple tool that converts numbers. It was invented by Oliver Wagner back in the good old Amiga days and is probably his greatest software ever. Since it’s faster to rewrite it from scratch than looking for a replacement, here it is.

Download the source here (release 1.8).

Example:

zapek@bacterion:~$ shownum 666
Number of bits used: 16 (2 bytes)
Dec: 666
Hex: 0x29a
Oct: 1232
Asc: ..
Bin: 0000001010011010
     ^---+---^---+---
zapek@bacterion:~$ shownum 0x574d5633
Number of bits used: 32 (4 bytes)
Dec: 1464686131
Hex: 0x574d5633
Oct: 12723253063
Asc: WMV3
Bin: 01010111010011010101011000110011
     ^---+---^---+---^---+---^---+---
zapek@bacterion:~$ shownum -1
Number of bits used: 64 (8 bytes)
Dec: 18446744073709551615   --- hi: 4294967295  lo: 4294967295
Hex: 0xffffffffffffffff     --- hi: 0xffffffff  lo: 0xffffffff
Oct: 1777777777777777777777 --- hi: 37777777777 lo: 37777777777
Asc: .... | ....
Bin: 11111111111111111111111111111111 | 11111111111111111111111111111111
     ^---+---^---+---^---+---^---+---   ^---+---^---+---^---+---^---+---
zapek@bacterion:~$ shownum plop
Number of bits used: 32 (4 bytes)
Dec: 1886154608
Hex: 0x706c6f70
Oct: 16033067560
Asc: plop
Bin: 01110000011011000110111101110000
     ^---+---^---+---^---+---^---+---

History:

version 1.3

  • merged in changes from Ian Kumlien to add 64-bit support

version 1.4

  • merged in changes from Ian Kumlien to format chars properly

version 1.5

  • changed %L to %ll because Apple sucks. Many thanks to JC for finding out

version 1.6

  • fixed junk being displayed after the ascii value

version 1.7
Changes from Ian Kumlien

  • Reworked the main code part to handle dynamic length numbers, it will now only display the “bytes” used.
  • Some code cleanups and reworking.
  • Switched to using 64bit datatypes due to enhanced restrictions with the compiler flags.
  • Now indicates nibbles with + and bytes with ^
  • Now displays the octal value as well if someone wants to know.
  • Removed -Werror since -ansi causes a warning on Mac OS X since they define PRIu64 using a q qualifier that is not ansi.
  • Added MSVC C99 compability from JC

version 1.8

  • updated URLs
  • fixed to build on FreeBSD (reported by Freaky)

GIT:
The git repository maintained by Ian Kumlien is accessible at:

https://github.com/pomac303/shownum.git