View Single Post
Old November 28, 2015, 21:24   #5
Join Date: Feb 2009
Posts: 56
jrodman is on a distinguished road
Originally Posted by Hajo View Post
I've been trying to compile this and get it running, but my compiled code seems to run into endless or at least very long loops in birth.c

Edit: Sorry. Must be a compiler problem. Rand_div always generates 0, that explains the problems. I'll see what went wrong there.

Edit: It works now. Seems the value table for the complex RNG was never initialized. Don't ask why, don't know either ...
Huh, this is frustrating. I'm trying to get a 2001-era variant running, and i'm getting similar symptoms. You found a problem but don't explain what you changed.

I think psi-angband is based on 2.9.x, and keeps hanging in z-rand, but I'm not sure why.

I can see in a debugger that Rand_state has stuff in it....

Hmm, in my case the problem was:

* the values are defined as u32b.
* However, they were 64bit
* The loop only escapes if the values are below a threshold based on 32 bit values, so the loop will last 4 billion times longer than intended.
* Using the define L64 worked (which was intended for DEC alpha) which used unsigned and signed int instead of 'long' for u32 etc.
* In practice, this means I added -D"L64" to the compiler flags in Makefile.std.

The original symptom was a parse problem in the info files, because the code assumes the memory will fit, but is using 8-byte integers instead of 4-byte, which overflows the zeroed memory space.
jrodman is offline   Reply With Quote