-/* $NetBSD: jrand48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $ */
+/* $NetBSD: jrand48.c,v 1.9 2013/10/22 08:08:51 matt Exp $ */
/*
* Copyright (c) 1993 Martin Birgmeier
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: jrand48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $");
+__RCSID("$NetBSD: jrand48.c,v 1.9 2013/10/22 08:08:51 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
_DIAGASSERT(xseed != NULL);
__dorand48(xseed);
- return ((long) xseed[2] << 16) + (long) xseed[1];
+ return (int16_t)xseed[2] * 65536 + xseed[1];
}
-/* $NetBSD: lrand48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $ */
+/* $NetBSD: lrand48.c,v 1.9 2013/10/22 08:08:51 matt Exp $ */
/*
* Copyright (c) 1993 Martin Birgmeier
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: lrand48.c,v 1.8 2005/06/12 05:21:28 lukem Exp $");
+__RCSID("$NetBSD: lrand48.c,v 1.9 2013/10/22 08:08:51 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
lrand48(void)
{
__dorand48(__rand48_seed);
- return (long)((unsigned long) __rand48_seed[2] << 15) +
- ((unsigned long) __rand48_seed[1] >> 1);
+ return __rand48_seed[2] * 32768 + (__rand48_seed[1] >> 1);
}
-/* $NetBSD: mrand48.c,v 1.7 2005/06/12 05:21:28 lukem Exp $ */
+/* $NetBSD: mrand48.c,v 1.8 2013/10/22 08:08:51 matt Exp $ */
/*
* Copyright (c) 1993 Martin Birgmeier
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: mrand48.c,v 1.7 2005/06/12 05:21:28 lukem Exp $");
+__RCSID("$NetBSD: mrand48.c,v 1.8 2013/10/22 08:08:51 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
mrand48(void)
{
__dorand48(__rand48_seed);
- return ((long) __rand48_seed[2] << 16) + (long) __rand48_seed[1];
+ return (int16_t)__rand48_seed[2] * 65536 + __rand48_seed[1];
}
-/* $NetBSD: nrand48.c,v 1.9 2005/06/12 05:21:28 lukem Exp $ */
+/* $NetBSD: nrand48.c,v 1.10 2013/10/22 08:08:51 matt Exp $ */
/*
* Copyright (c) 1993 Martin Birgmeier
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: nrand48.c,v 1.9 2005/06/12 05:21:28 lukem Exp $");
+__RCSID("$NetBSD: nrand48.c,v 1.10 2013/10/22 08:08:51 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
_DIAGASSERT(xseed != NULL);
__dorand48(xseed);
- return (long)((unsigned long) xseed[2] << 15) +
- ((unsigned long) xseed[1] >> 1);
+ return xseed[2] * 32768 + (xseed[1] >> 1);
}