summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2003-07-22 16:44:21 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2003-07-22 16:44:21 +0000
commit4a51df400b87409fd6827e60ed337cdfe3589004 (patch)
treed744f672eec78880aa3a5ce82ebc8dc178d54c56
parentb7cd979298aa3681a4218db4d621410dde6718d7 (diff)
downloadATCD-4a51df400b87409fd6827e60ed337cdfe3589004.tar.gz
ChangeLogTag: Tue Jul 22 16:42:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r--ChangeLog5
-rw-r--r--ace/OS.i19
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:
diff --git a/ace/OS.i b/ace/OS.i
index 192e5e26537..bc2f23d6246 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -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