aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/drand48.c2
-rw-r--r--stdlib/drand48_r.c2
-rw-r--r--stdlib/erand48.c2
-rw-r--r--stdlib/erand48_r.c3
-rw-r--r--stdlib/jrand48.c6
-rw-r--r--stdlib/jrand48_r.c5
-rw-r--r--stdlib/lcong48.c2
-rw-r--r--stdlib/lcong48_r.c13
-rw-r--r--stdlib/lrand48.c6
-rw-r--r--stdlib/lrand48_r.c2
-rw-r--r--stdlib/mrand48.c6
-rw-r--r--stdlib/mrand48_r.c2
-rw-r--r--stdlib/nrand48.c6
-rw-r--r--stdlib/nrand48_r.c5
-rw-r--r--stdlib/seed48.c2
-rw-r--r--stdlib/seed48_r.c3
-rw-r--r--stdlib/srand48.c2
-rw-r--r--stdlib/srand48_r.c3
-rw-r--r--stdlib/stdlib.h18
19 files changed, 61 insertions, 29 deletions
diff --git a/stdlib/drand48.c b/stdlib/drand48.c
index 15c84a7..7fa6f33 100644
--- a/stdlib/drand48.c
+++ b/stdlib/drand48.c
@@ -27,7 +27,7 @@ drand48 ()
{
double result;
- (void) erand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
+ (void) __erand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
return result;
}
diff --git a/stdlib/drand48_r.c b/stdlib/drand48_r.c
index 27d6b5c..7ce500a 100644
--- a/stdlib/drand48_r.c
+++ b/stdlib/drand48_r.c
@@ -26,5 +26,5 @@ drand48_r (buffer, result)
struct drand48_data *buffer;
double *result;
{
- return erand48_r (buffer->X, buffer, result);
+ return __erand48_r (buffer->X, buffer, result);
}
diff --git a/stdlib/erand48.c b/stdlib/erand48.c
index 345fca3..d9784ca 100644
--- a/stdlib/erand48.c
+++ b/stdlib/erand48.c
@@ -28,7 +28,7 @@ erand48 (xsubi)
{
double result;
- (void) erand48_r (xsubi, &__libc_drand48_data, &result);
+ (void) __erand48_r (xsubi, &__libc_drand48_data, &result);
return result;
}
diff --git a/stdlib/erand48_r.c b/stdlib/erand48_r.c
index 958c2e2..40c3665 100644
--- a/stdlib/erand48_r.c
+++ b/stdlib/erand48_r.c
@@ -23,7 +23,7 @@
int
-erand48_r (xsubi, buffer, result)
+__erand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
double *result;
@@ -50,3 +50,4 @@ erand48_r (xsubi, buffer, result)
return 0;
}
+weak_alias (__erand48_r, erand48_r)
diff --git a/stdlib/jrand48.c b/stdlib/jrand48.c
index 3da2516..c9802f0 100644
--- a/stdlib/jrand48.c
+++ b/stdlib/jrand48.c
@@ -22,13 +22,13 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
-long
+long int
jrand48 (xsubi)
unsigned short int xsubi[3];
{
- long result;
+ long int result;
- (void) jrand48_r (xsubi, &__libc_drand48_data, &result);
+ (void) __jrand48_r (xsubi, &__libc_drand48_data, &result);
return result;
}
diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c
index 648604d..ce4c8b0 100644
--- a/stdlib/jrand48_r.c
+++ b/stdlib/jrand48_r.c
@@ -20,10 +20,10 @@
#include <stdlib.h>
int
-jrand48_r (xsubi, buffer, result)
+__jrand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
- long *result;
+ long int *result;
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@@ -40,3 +40,4 @@ jrand48_r (xsubi, buffer, result)
return 0;
}
+weak_alias (__jrand48_r, jrand48_r)
diff --git a/stdlib/lcong48.c b/stdlib/lcong48.c
index a9ef571..b6e4170 100644
--- a/stdlib/lcong48.c
+++ b/stdlib/lcong48.c
@@ -26,5 +26,5 @@ void
lcong48 (param)
unsigned short int param[7];
{
- (void) lcong48_r (param, &__libc_drand48_data);
+ (void) __lcong48_r (param, &__libc_drand48_data);
}
diff --git a/stdlib/lcong48_r.c b/stdlib/lcong48_r.c
index 037fd49..c7baa38 100644
--- a/stdlib/lcong48_r.c
+++ b/stdlib/lcong48_r.c
@@ -21,15 +21,26 @@
#include <string.h>
int
-lcong48_r (param, buffer)
+__lcong48_r (param, buffer)
unsigned short int param[7];
struct drand48_data *buffer;
{
/* Store the given values. */
+#if USHRT_MAX == 0xffffU
memcpy (buffer->X, &param[0], sizeof (buffer->X));
memcpy (buffer->a, &param[3], sizeof (buffer->a));
+#else
+ buffer->X[2] = (param[2] << 16) | param[1];
+ buffer->X[1] = param[0] << 16;
+ buffer->X[0] = 0;
+
+ buffer->a[2] = (param[5] << 16) | param[4];
+ buffer->a[1] = param[3] << 16;
+ buffer->a[0] = 0;
+#endif
buffer->c = param[6];
buffer->init = 1;
return 0;
}
+weak_alias (__lcong48_r, lcong48_r)
diff --git a/stdlib/lrand48.c b/stdlib/lrand48.c
index 2f5530b..0c25935 100644
--- a/stdlib/lrand48.c
+++ b/stdlib/lrand48.c
@@ -22,12 +22,12 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
-long
+long int
lrand48 ()
{
- long result;
+ long int result;
- (void) nrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
+ (void) __nrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
return result;
}
diff --git a/stdlib/lrand48_r.c b/stdlib/lrand48_r.c
index 8c20cf5..de4dd99 100644
--- a/stdlib/lrand48_r.c
+++ b/stdlib/lrand48_r.c
@@ -22,7 +22,7 @@
int
lrand48_r (buffer, result)
struct drand48_data *buffer;
- long *result;
+ long int *result;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)
diff --git a/stdlib/mrand48.c b/stdlib/mrand48.c
index 9a68cbf..9b0507c 100644
--- a/stdlib/mrand48.c
+++ b/stdlib/mrand48.c
@@ -22,12 +22,12 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
-long
+long int
mrand48 ()
{
- long result;
+ long int result;
- (void) jrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
+ (void) __jrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
return result;
}
diff --git a/stdlib/mrand48_r.c b/stdlib/mrand48_r.c
index 0c9819a..23c0a15 100644
--- a/stdlib/mrand48_r.c
+++ b/stdlib/mrand48_r.c
@@ -22,7 +22,7 @@
int
mrand48_r (buffer, result)
struct drand48_data *buffer;
- long *result;
+ long int *result;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)
diff --git a/stdlib/nrand48.c b/stdlib/nrand48.c
index dc64627..5ec7bd7 100644
--- a/stdlib/nrand48.c
+++ b/stdlib/nrand48.c
@@ -22,13 +22,13 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
-long
+long int
nrand48 (xsubi)
unsigned short int xsubi[3];
{
- long result;
+ long int result;
- (void) nrand48_r (xsubi, &__libc_drand48_data, &result);
+ (void) __nrand48_r (xsubi, &__libc_drand48_data, &result);
return result;
}
diff --git a/stdlib/nrand48_r.c b/stdlib/nrand48_r.c
index 178be0b..093a4e2 100644
--- a/stdlib/nrand48_r.c
+++ b/stdlib/nrand48_r.c
@@ -20,10 +20,10 @@
#include <stdlib.h>
int
-nrand48_r (xsubi, buffer, result)
+__nrand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
- long *result;
+ long int *result;
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@@ -37,3 +37,4 @@ nrand48_r (xsubi, buffer, result)
return 0;
}
+weak_alias (__nrand48_r, nrand48_r)
diff --git a/stdlib/seed48.c b/stdlib/seed48.c
index 436cc8b..f8f31b2 100644
--- a/stdlib/seed48.c
+++ b/stdlib/seed48.c
@@ -26,7 +26,7 @@ unsigned short int *
seed48 (seed16v)
unsigned short int seed16v[3];
{
- (void) seed48_r (seed16v, &__libc_drand48_data);
+ (void) __seed48_r (seed16v, &__libc_drand48_data);
return __libc_drand48_data.old_X;
}
diff --git a/stdlib/seed48_r.c b/stdlib/seed48_r.c
index 186d96c..31a5856 100644
--- a/stdlib/seed48_r.c
+++ b/stdlib/seed48_r.c
@@ -21,7 +21,7 @@
#include <string.h>
int
-seed48_r (seed16v, buffer)
+__seed48_r (seed16v, buffer)
unsigned short int seed16v[3];
struct drand48_data *buffer;
{
@@ -51,3 +51,4 @@ seed48_r (seed16v, buffer)
return 0;
}
+weak_alias (__seed48_r, seed48_r)
diff --git a/stdlib/srand48.c b/stdlib/srand48.c
index 9bd248a..eed09a4 100644
--- a/stdlib/srand48.c
+++ b/stdlib/srand48.c
@@ -26,5 +26,5 @@ void
srand48 (seedval)
long seedval;
{
- (void) srand48_r (seedval, &__libc_drand48_data);
+ (void) __srand48_r (seedval, &__libc_drand48_data);
}
diff --git a/stdlib/srand48_r.c b/stdlib/srand48_r.c
index 042c669..763d5c4 100644
--- a/stdlib/srand48_r.c
+++ b/stdlib/srand48_r.c
@@ -21,7 +21,7 @@
#include <limits.h>
int
-srand48_r (seedval, buffer)
+__srand48_r (seedval, buffer)
long int seedval;
struct drand48_data *buffer;
{
@@ -51,3 +51,4 @@ srand48_r (seedval, buffer)
return 0;
}
+weak_alias (__srand48_r, srand48_r)
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 4e60201..98ed889 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -211,7 +211,7 @@ extern __inline int atoi (__const char *__nptr)
extern __inline long int atol (__const char *__nptr)
{ return strtol (__nptr, (char **) NULL, 10); }
-#if defined __USE_ISOC9X && (defined __GNUC__ || defined __USE_MISC)
+#if defined __USE_MISC || defined __USE_ISOC9X
extern __inline long long int atoll (__const char *__nptr)
{ return strtoll (__nptr, (char **) NULL, 10); }
#endif
@@ -335,23 +335,39 @@ struct drand48_data
#ifdef __USE_MISC
/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
extern int drand48_r __P ((struct drand48_data *__buffer, double *__result));
+extern int __erand48_r __P ((unsigned short int __xsubi[3],
+ struct drand48_data *__buffer, double *__result));
extern int erand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, double *__result));
/* Return non-negative, long integer in [0,2^31). */
extern int lrand48_r __P ((struct drand48_data *__buffer, long int *__result));
+extern int __nrand48_r __P ((unsigned short int __xsubi[3],
+ struct drand48_data *__buffer,
+ long int *__result));
extern int nrand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, long int *__result));
/* Return signed, long integers in [-2^31,2^31). */
extern int mrand48_r __P ((struct drand48_data *__buffer, long int *__result));
+extern int __jrand48_r __P ((unsigned short int __xsubi[3],
+ struct drand48_data *__buffer,
+ long int *__result));
extern int jrand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, long int *__result));
/* Seed random number generator. */
+extern int __srand48_r __P ((long int __seedval,
+ struct drand48_data *__buffer));
extern int srand48_r __P ((long int __seedval, struct drand48_data *__buffer));
+
+extern int __seed48_r __P ((unsigned short int __seed16v[3],
+ struct drand48_data *__buffer));
extern int seed48_r __P ((unsigned short int __seed16v[3],
struct drand48_data *__buffer));
+
+extern int __lcong48_r __P ((unsigned short int __param[7],
+ struct drand48_data *__buffer));
extern int lcong48_r __P ((unsigned short int __param[7],
struct drand48_data *__buffer));
#endif /* Use misc. */