… | |
… | |
40 | |
40 | |
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 | |
|
|
46 | #if !GCC_VERSION(3,4) |
|
|
47 | int least_significant_bit (uint32_t x) |
|
|
48 | { |
|
|
49 | x &= -x; // this isolates the lowest bit |
|
|
50 | |
|
|
51 | int r = 0; |
|
|
52 | |
|
|
53 | if (x & 0xaaaaaaaa) r += 1; |
|
|
54 | if (x & 0xcccccccc) r += 2; |
|
|
55 | if (x & 0xf0f0f0f0) r += 4; |
|
|
56 | if (x & 0xff00ff00) r += 8; |
|
|
57 | if (x & 0xffff0000) r += 16; |
|
|
58 | |
|
|
59 | return r; |
|
|
60 | } |
|
|
61 | #endif |
|
|
62 | |
45 | |
63 | /******************************************************************************/ |
46 | /******************************************************************************/ |
64 | |
47 | |
65 | /* Checks a player-provided string which will become the msg property of |
48 | /* Checks a player-provided string which will become the msg property of |
66 | * an object for dangerous input. |
49 | * an object for dangerous input. |