aboutsummaryrefslogtreecommitdiff
path: root/stdlib/srand48_r.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-23 10:00:23 +0000
committerRoland McGrath <roland@gnu.org>1996-01-23 10:00:23 +0000
commit1d8dc4293f772369e2da018ba5f1bf6e67967f3a (patch)
treee3b745c6fd5c1de37f20768079a419cebacdd41e /stdlib/srand48_r.c
parentf2f7f9e665975125ef253d7a621bcc3e4f68904d (diff)
downloadglibc-1d8dc4293f772369e2da018ba5f1bf6e67967f3a.zip
glibc-1d8dc4293f772369e2da018ba5f1bf6e67967f3a.tar.gz
glibc-1d8dc4293f772369e2da018ba5f1bf6e67967f3a.tar.bz2
Mon Jan 22 10:40:40 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>cvs/libc-960123
* sysdeps/posix/getcwd.c [__GNU_LIBRARY__]: Include unistd.h. * io/fts.h (FTSENT): Define fts_compar member with prototype. * hurd/hurd.h: Use prototype in getcttyid decl. * stdlib/l64a.c: Fix typo in last change. * stdlib/drand48-iter.c: Test limits.h macros instead of sizeof for determining size of types. * stdlib/srand48_r.c: Likewise. * misc/utmp.h: Declare login, logout, logwtmp. * misc/logout.c: Declare argument as pointer to const. * misc/login.c: Likewise. * misc/logwtmp.c: Likewise. Include time.h, string.h. * misc/efgcvt_r.c: Include stdlib.h. * io/mknod.c: Include sys/types.h. * gmon/sys/gmon.h: Declare monstartup, _mcleanup. * csu/gmon-start.c (_start, etext): Declare with prototypes. * stdio-common/vfscanf.c (%[): Fix range handling.
Diffstat (limited to 'stdlib/srand48_r.c')
-rw-r--r--stdlib/srand48_r.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/stdlib/srand48_r.c b/stdlib/srand48_r.c
index 8720854..44cee6d 100644
--- a/stdlib/srand48_r.c
+++ b/stdlib/srand48_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
@@ -18,6 +18,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdlib.h>
+#include <limits.h>
int
srand48_r (seedval, buffer)
@@ -28,18 +29,15 @@ srand48_r (seedval, buffer)
if (sizeof (long) > 4)
seedval &= 0xffffffffl;
- if (sizeof (unsigned short int) == 2)
- {
- buffer->X[2] = seedval >> 16;
- buffer->X[1] = seedval & 0xffffl;
- buffer->X[0] = 0x330e;
- }
- else
- {
- buffer->X[2] = seedval;
- buffer->X[1] = 0x330e0000UL;
- buffer->X[0] = 0;
- }
+#if (USHRT_MAX == 0xffffU)
+ buffer->X[2] = seedval >> 16;
+ buffer->X[1] = seedval & 0xffffl;
+ buffer->X[0] = 0x330e;
+#else
+ buffer->X[2] = seedval;
+ buffer->X[1] = 0x330e0000UL;
+ buffer->X[0] = 0;
+#endif
return 0;
}