Source-Changes-HG archive

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

[src/trunk]: src/sys/dev portability fix: when rotating, don't do shifts >= w...



details:   https://anonhg.NetBSD.org/src/rev/e950a6aa8e80
branches:  trunk
changeset: 487643:e950a6aa8e80
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Sat Jun 10 17:01:15 2000 +0000

description:
portability fix: when rotating, don't do shifts >= wordsize.

diffstat:

 sys/dev/rndpool.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r f7ea952f13f7 -r e950a6aa8e80 sys/dev/rndpool.c
--- a/sys/dev/rndpool.c Sat Jun 10 16:31:42 2000 +0000
+++ b/sys/dev/rndpool.c Sat Jun 10 17:01:15 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rndpool.c,v 1.9 2000/06/05 23:42:34 sommerfeld Exp $        */
+/*      $NetBSD: rndpool.c,v 1.10 2000/06/10 17:01:15 sommerfeld Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -141,9 +141,10 @@
        val ^= rp->pool[(rp->cursor + TAP3) & (RND_POOLWORDS - 1)];
        val ^= rp->pool[(rp->cursor + TAP4) & (RND_POOLWORDS - 1)];
        val ^= rp->pool[(rp->cursor + TAP5) & (RND_POOLWORDS - 1)];
-       rp->pool[rp->cursor++] ^=
-         ((val << rp->rotate) | (val >> (32 - rp->rotate)));
-
+       if (rp->rotate != 0)
+               val = ((val << rp->rotate) | (val >> (32 - rp->rotate)));
+       rp->pool[rp->cursor++] ^= val;
+       
        /*
         * If we have looped around the pool, increment the rotate
         * variable so the next value will get xored in rotated to



Home | Main Index | Thread Index | Old Index