… | |
… | |
41 | #include <glib.h> |
41 | #include <glib.h> |
42 | |
42 | |
43 | refcnt_base::refcnt_t refcnt_dummy; |
43 | refcnt_base::refcnt_t refcnt_dummy; |
44 | ssize_t slice_alloc; |
44 | ssize_t slice_alloc; |
45 | rand_gen rndm, rmg_rndm; |
45 | rand_gen rndm, rmg_rndm; |
|
|
46 | |
|
|
47 | #if !GCC_VERSION(3,4) |
|
|
48 | int least_significant_bit (uint32_t x) |
|
|
49 | { |
|
|
50 | x &= -x; // this isolates the lowest bit |
|
|
51 | |
|
|
52 | int r = 0; |
|
|
53 | |
|
|
54 | if (x & 0xaaaaaaaa) r += 1; |
|
|
55 | if (x & 0xcccccccc) r += 2; |
|
|
56 | if (x & 0xf0f0f0f0) r += 4; |
|
|
57 | if (x & 0xff00ff00) r += 8; |
|
|
58 | if (x & 0xffff0000) r += 16; |
|
|
59 | |
|
|
60 | return r; |
|
|
61 | } |
|
|
62 | #endif |
46 | |
63 | |
47 | void |
64 | void |
48 | tausworthe_random_generator::seed (uint32_t seed) |
65 | tausworthe_random_generator::seed (uint32_t seed) |
49 | { |
66 | { |
50 | state [0] = seed * 69069U; if (state [0] < 2U) state [0] += 2U; |
67 | state [0] = seed * 69069U; if (state [0] < 2U) state [0] += 2U; |