… | |
… | |
42 | rand_gen rndm; |
42 | rand_gen rndm; |
43 | |
43 | |
44 | void |
44 | void |
45 | tausworthe_random_generator::seed (uint32_t seed) |
45 | tausworthe_random_generator::seed (uint32_t seed) |
46 | { |
46 | { |
47 | state [0] = max ( 2, seed * 69069U); |
47 | state [0] = max ( 2U, seed * 69069U); |
48 | state [1] = max ( 8, state [0] * 69069U); |
48 | state [1] = max ( 8U, state [0] * 69069U); |
49 | state [2] = max ( 16, state [1] * 69069U); |
49 | state [2] = max ( 16U, state [1] * 69069U); |
50 | state [3] = max (128, state [2] * 69069U); |
50 | state [3] = max (128U, state [2] * 69069U); |
51 | |
51 | |
52 | for (int i = 11; --i; ) |
52 | for (int i = 11; --i; ) |
53 | operator ()(); |
53 | operator ()(); |
54 | } |
54 | } |
55 | |
55 | |
… | |
… | |
570 | LOG (llevError, "fork abort: %s\n", msg); |
570 | LOG (llevError, "fork abort: %s\n", msg); |
571 | } |
571 | } |
572 | |
572 | |
573 | void *salloc_ (int n) throw (std::bad_alloc) |
573 | void *salloc_ (int n) throw (std::bad_alloc) |
574 | { |
574 | { |
|
|
575 | #ifdef PREFER_MALLOC |
|
|
576 | void *ptr = malloc (n); |
|
|
577 | #else |
575 | void *ptr = g_slice_alloc (n); |
578 | void *ptr = g_slice_alloc (n); |
|
|
579 | #endif |
576 | |
580 | |
577 | if (!ptr) |
581 | if (!ptr) |
578 | throw std::bad_alloc (); |
582 | throw std::bad_alloc (); |
579 | |
583 | |
580 | return ptr; |
584 | return ptr; |