Fix #1: Fix 32-bit compilation

Fix a few instances of 'error: cast from pointer to integer of different size'
(and the inverse) on 32-bit compilation by using correct casting.