Enclosed is the diff to remove 'long long' from the code. I used diff -c, most people like it. If you prefer a different format, please let me know.
Now for the decisions. You use shorts, longs and ints throughout the code. On alphas, a long is 64 bits. I suspect the same will happen on 64 bit sparc and I know it has happened on the ia64. It is not always documented how many bits a specific value is expected to hold and I do not understand the code well enough yet to make the decisions.
The items to use are [u]int16_t, [u]int32_t, and [u]int64_t. If you want to be uniform there is also [u]int8_t (char).