summaryrefslogtreecommitdiff
path: root/libc/stdlib/lcong48.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2011-04-12 22:01:42 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-15 14:00:36 +0200
commitdc0a93c756035fb319f45b53585e9fbb9f8e36fa (patch)
tree297bf9b9b05f95bb829b1c9b46b3fa7124cb8978 /libc/stdlib/lcong48.c
parentf503f6a97092a349a8de7fac1cde2ef5b3beaf5b (diff)
add lcong48[_r]
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/stdlib/lcong48.c')
-rw-r--r--libc/stdlib/lcong48.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libc/stdlib/lcong48.c b/libc/stdlib/lcong48.c
new file mode 100644
index 000000000..06cab6672
--- /dev/null
+++ b/libc/stdlib/lcong48.c
@@ -0,0 +1,29 @@
+/* vi: set sw=4 ts=4: */
+/* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */
+
+#include <features.h>
+
+#if defined __USE_SVID || defined __USE_XOPEN
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int __lcong48_r (unsigned short int param[7], struct drand48_data *buffer)
+{
+ /* Store the given values. */
+ memcpy (buffer->__x, &param[0], sizeof (buffer->__x));
+ buffer->__a = ((uint64_t) param[5] << 32 | (uint32_t) param[4] << 16 | param[3]);
+ buffer->__c = param[6];
+ buffer->__init = 1;
+
+ return 0;
+}
+# ifdef __USE_MISC
+strong_alias(__lcong48_r,lcong48_r)
+# endif
+
+void lcong48 (unsigned short int param[7])
+{
+ (void) __lcong48_r (param, &__libc_drand48_data);
+}
+#endif