port code to 64-bit architectures

This involved changing all the ints which held pointers to longs, or
at least the ones I could find with the help of the Java and C/C++
compilers.  I've only tested a small subset of this code so far (just
the NIO stuff), so there's a good chance I missed something somewhere.