Fixed compiler warnings.

These were caused by improper casting; the code used `(void*) x` on `int`, and because the size of a void pointer on 64-bit systems is 64 bits, and of `int` - 32 bits, this could give invalid results if it wasn't for compiler extensions.