bb is a hex calculator for the console. bb makes working with hexadecimal numbers as painless as possible.
See the files README and FEATURES for details.
Some features of bb:
Here is the current list of operators to give you an impression what bb can do:
Operators --------- + addition - subtraction * multiplication / integer division % remainder // floor of real division %% modulo (zero or same sign as divisor) & bitwise AND | bitwise OR ^ bitwise XOR unary - negation unary ~ complement << shift left >> shift right s>> signed shift right <<< rotate left >>> rotate right u*u multiplication with zero/zero extension s*u multiplication with sign/zero extension u*s multiplication with zero/sign extension s*s multiplication with sign/sign extension u/u unsigned division s/u signed/unsigned division u/s unsigned/signed division s/s signed/signed division :hi# select high # bits :lo# select low # bits :msb select MSB :lsb select LSB :# select bit # :#-# select bit range (can use 'msb' and 'lsb' in place of #) :(...) select bit list, eg. :(0,5-msb) [...]# put in a box of # bits width unary ^ unbox unary ^s unbox signed <- name binding NOTE: The # in this list are decimal numbers that are regarded as quoted by bb -- and therefore always interpreted as decimal. You cannot put expressions there. NOTE: Many operators only exhibit their special behaviour when working on boxes (ie. values of fixed width). NOTE: The division and remainder/modulo operators satisfy the following equations: (a / b) * b + (a % b) == a (a // b) * b + (a %% b) == a
See the file README in the tarball for more information.