Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/stdlib Change the previous cast from unsigned int t...



details:   https://anonhg.NetBSD.org/src/rev/5de27b7fe6e8
branches:  trunk
changeset: 849206:5de27b7fe6e8
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun Feb 23 09:53:42 2020 +0000

description:
Change the previous cast from unsigned int to unsigned long

This code produces the same result and is consistent with the previous
lines. Only the least significant 16 bites (unsigned short) are meaningful.

diffstat:

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

diffs (31 lines):

diff -r 90e8d53c8f48 -r 5de27b7fe6e8 lib/libc/stdlib/_rand48.c
--- a/lib/libc/stdlib/_rand48.c Sun Feb 23 09:24:12 2020 +0000
+++ b/lib/libc/stdlib/_rand48.c Sun Feb 23 09:53:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _rand48.c,v 1.9 2020/02/22 14:07:57 kamil Exp $        */
+/*     $NetBSD: _rand48.c,v 1.10 2020/02/23 09:53:42 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.9 2020/02/22 14:07:57 kamil Exp $");
+__RCSID("$NetBSD: _rand48.c,v 1.10 2020/02/23 09:53:42 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -50,9 +50,9 @@
        accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
        temp[1] = (unsigned short) accu;        /* middle 16 bits */
        accu >>= sizeof(unsigned short) * 8;
-       accu += (unsigned int) __rand48_mult[0] * (unsigned int) xseed[2];
-       accu += (unsigned int) __rand48_mult[1] * (unsigned int) xseed[1];
-       accu += (unsigned int) __rand48_mult[2] * (unsigned int) xseed[0];
+       accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[2];
+       accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[1];
+       accu += (unsigned long) __rand48_mult[2] * (unsigned long) xseed[0];
        xseed[0] = temp[0];
        xseed[1] = temp[1];
        xseed[2] = (unsigned short) accu;



Home | Main Index | Thread Index | Old Index