fix for bugs in the bits primitive operations

See previous commit message for the explanation of the bug.

This commit gives the right fix for the bug, which is to take out the values
that you will need from the arguments before using the allocator.  The reason
is that the allocator may trigger a GC collection which will move your
arguments away. While you can use the resulting FWD pointer to get the data,
FWD values should never be used outside of the garbage collector.  The gmp
operations should be looked at to make sure it is not doing this.

In summary, any C code that uses the allocator should save any relevant values
that its pointers are pointing to first.