diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-22 16:44:21 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-22 16:44:21 +0000 |
commit | 4a51df400b87409fd6827e60ed337cdfe3589004 (patch) | |
tree | d744f672eec78880aa3a5ce82ebc8dc178d54c56 | |
parent | b7cd979298aa3681a4218db4d621410dde6718d7 (diff) | |
download | ATCD-4a51df400b87409fd6827e60ed337cdfe3589004.tar.gz |
ChangeLogTag: Tue Jul 22 16:42:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ace/OS.i | 19 |
2 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 22af8c51a1d..7fb57935edb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 22 16:43:01 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/OS.i: + Changed new rand_r() implementation a little bit + Tue Jul 22 15:12:02 UTC 2003 Don Hinton <dhinton@dresystems.com> * ace/iosfwd.h: @@ -522,16 +522,15 @@ ACE_OS::rand_r (ACE_RANDR_TYPE& seed) { ACE_OS_TRACE ("ACE_OS::rand_r"); - long k; - long s = (long)(seed); - if (s == 0) - s = 0x12345987; - k = s / 127773; - s = 16807 * (s - k * 127773) - 2836 * k; - if (s < 0) - s += 2147483647; - (seed) = (unsigned int)s; - return (int)(s & RAND_MAX); + long new_seed = (long)(seed); + if (new_seed == 0) + new_seed = 0x12345987; + long temp = new_seed / 127773; + new_seed = 16807 * (new_seed - temp * 127773) - 2836 * temp; + if (new_seed < 0) + new_seed += 2147483647; + (seed) = (unsigned int)new_seed; + return (int)(new_seed & RAND_MAX); } ACE_INLINE pid_t |