Module Name: src
Committed By: kamil
Date: Sat Feb 22 11:24:47 UTC 2020
Modified Files:
src/lib/libc/stdlib: _rand48.c
Log Message:
Improve readability of __dorand48()
Break long lines into shorter instructions per line.
No Functional Change.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdlib/_rand48.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/_rand48.c
diff -u src/lib/libc/stdlib/_rand48.c:1.7 src/lib/libc/stdlib/_rand48.c:1.8
--- src/lib/libc/stdlib/_rand48.c:1.7 Sun Jun 12 05:21:27 2005
+++ src/lib/libc/stdlib/_rand48.c Sat Feb 22 11:24:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: _rand48.c,v 1.7 2005/06/12 05:21:27 lukem Exp $ */
+/* $NetBSD: _rand48.c,v 1.8 2020/02/22 11:24:47 kamil Exp $ */
/*
* Copyright (c) 1993 Martin Birgmeier
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _rand48.c,v 1.7 2005/06/12 05:21:27 lukem Exp $");
+__RCSID("$NetBSD: _rand48.c,v 1.8 2020/02/22 11:24:47 kamil Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
@@ -42,12 +42,12 @@ __dorand48(unsigned short xseed[3])
_DIAGASSERT(xseed != NULL);
- accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0] +
- (unsigned long) __rand48_add;
+ accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0];
+ accu += (unsigned long) __rand48_add;
temp[0] = (unsigned short) accu; /* lower 16 bits */
accu >>= sizeof(unsigned short) * 8;
- accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1] +
- (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
+ accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1];
+ accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
temp[1] = (unsigned short) accu; /* middle 16 bits */
accu >>= sizeof(unsigned short) * 8;
accu += __rand48_mult[0] * xseed[2] + __rand48_mult[1] * xseed[1] + __rand48_mult[2] * xseed[0];