check_group_atari(): Use lumpiness guard only as preference, not for total pruning
[pachi/pachi-r6144.git] / fixp.h
blob9b5a0f147f8d303a1e003369fe88a91b8d2d7a26
1 #ifndef ZZGO_FIXP_H
2 #define ZZGO_FIXP_H
4 /* Tools for counting fixed-point numbers. */
6 /* We implement a simple fixed-point number type, with fixed number of
7 * fractional binary digits after the radix point. */
9 #include <stdint.h>
11 typedef uint_fast32_t fixp_t;
13 /* We should accomodate at least 0..131072 (17bits) in the whole number
14 * portion; assuming at least 32bit integer, that leaves us with 15-bit
15 * fractional part. Thankfully, we need only unsigned values. */
16 #define FIXP_BITS 15
18 #define FIXP_SCALE (1<<FIXP_BITS)
20 #define double_to_fixp(n) ((fixp_t) ((n) * (FIXP_SCALE)))
21 #define fixp_to_double(n) ((double) (n) / FIXP_SCALE)
23 #endif