ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.C
(Generate patch)

Comparing deliantra/server/common/utils.C (file contents):
Revision 1.93 by root, Wed Nov 4 00:02:48 2009 UTC vs.
Revision 1.94 by root, Wed Nov 11 03:52:44 2009 UTC

41#include <glib.h> 41#include <glib.h>
42 42
43refcnt_base::refcnt_t refcnt_dummy; 43refcnt_base::refcnt_t refcnt_dummy;
44ssize_t slice_alloc; 44ssize_t slice_alloc;
45rand_gen rndm, rmg_rndm; 45rand_gen rndm, rmg_rndm;
46
47#if !GCC_VERSION(3,4)
48int 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
47void 64void
48tausworthe_random_generator::seed (uint32_t seed) 65tausworthe_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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines