more 64-bit fixes (don't rely on std.math)