This "solved" my segfaults, but since then I haven't been able to reproduce
my segfaults. So I'm not sure what was going on. This is the way that I
originally wrote that function, with the temp variable, and it seemed to
help. I didn't store the ints in a tmp variable because Val_int is just a
macro, defined as a left shift and plus one, so that couldn't have been a
problem.

And yes, I wonder about other unsafe bits as well...