Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib Improve readability of __dorand48()



details:   https://anonhg.NetBSD.org/src/rev/664f93ceb045
branches:  trunk
changeset: 969492:664f93ceb045
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Feb 22 11:24:47 2020 +0000

description:
Improve readability of __dorand48()

Break long lines into shorter instructions per line.

No Functional Change.

diffstat:

 lib/libc/stdlib/_rand48.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r 374321fba046 -r 664f93ceb045 lib/libc/stdlib/_rand48.c
--- a/lib/libc/stdlib/_rand48.c Sat Feb 22 10:30:37 2020 +0000
+++ b/lib/libc/stdlib/_rand48.c Sat Feb 22 11:24:47 2020 +0000
@@ -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 @@
 
        _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];



Home | Main Index | Thread Index | Old Index