… | |
… | |
32 | ((unsigned int)(val) - (unsigned int)(beg) <= (unsigned int)(end) - (unsigned int)(beg)) |
32 | ((unsigned int)(val) - (unsigned int)(beg) <= (unsigned int)(end) - (unsigned int)(beg)) |
33 | |
33 | |
34 | // in range excluding end |
34 | // in range excluding end |
35 | #define IN_RANGE_EXC(val,beg,end) \ |
35 | #define IN_RANGE_EXC(val,beg,end) \ |
36 | ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg)) |
36 | ((unsigned int)(val) - (unsigned int)(beg) < (unsigned int)(end) - (unsigned int)(beg)) |
|
|
37 | |
|
|
38 | void fork_abort (const char *msg); |
37 | |
39 | |
38 | // this is much faster than crossfires original algorithm |
40 | // this is much faster than crossfires original algorithm |
39 | // on modern cpus |
41 | // on modern cpus |
40 | inline int |
42 | inline int |
41 | isqrt (int n) |
43 | isqrt (int n) |
… | |
… | |
58 | #if 0 |
60 | #if 0 |
59 | return dx_ > dy_ |
61 | return dx_ > dy_ |
60 | ? (dx_ * 61685 + dy_ * 26870) >> 16 |
62 | ? (dx_ * 61685 + dy_ * 26870) >> 16 |
61 | : (dy_ * 61685 + dx_ * 26870) >> 16; |
63 | : (dy_ * 61685 + dx_ * 26870) >> 16; |
62 | #else |
64 | #else |
63 | return dx + dy - min (dx, dy) * 5 / 8; |
65 | return dx_ + dy_ - min (dx_, dy_) * 5 / 8; |
64 | #endif |
66 | #endif |
65 | } |
67 | } |
66 | |
68 | |
67 | /* |
69 | /* |
68 | * absdir(int): Returns a number between 1 and 8, which represent |
70 | * absdir(int): Returns a number between 1 and 8, which represent |