#Bit Manipulation Puzzles
This is a series of functions that utilize bit patterns to manipulate integers. Each function is limited to using only certain types of bit operations and a certain number of them.
There are three main categories of functions:
-
Bit manipulation - functions that manipulate & test sets of bits
-
Two's complement arithmetic - involve two's complement representations
-
Floating point arithmetic - operations on bit-level representations of floating point numbers.
Some selected examples:
-
bang(x)
- Compute!x
without using!
-
float_f2i(f)
- Givenfloat f
, compute(int) f
-
howManyBits(x)
- Return the minimum number of bits needed to representx
in two's complement
All functions have a header containing a description & examples.