Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/nbperf Most CPUs implement shifts modulo the width, ...



details:   https://anonhg.NetBSD.org/src/rev/37b9d05dc597
branches:  trunk
changeset: 329045:37b9d05dc597
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Apr 30 21:04:58 2014 +0000

description:
Most CPUs implement shifts modulo the width, but ARM doesn't. Don't
depend on this UB.

diffstat:

 usr.bin/nbperf/nbperf-bdz.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 4d1eaf013b2e -r 37b9d05dc597 usr.bin/nbperf/nbperf-bdz.c
--- a/usr.bin/nbperf/nbperf-bdz.c       Wed Apr 30 21:04:21 2014 +0000
+++ b/usr.bin/nbperf/nbperf-bdz.c       Wed Apr 30 21:04:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nbperf-bdz.c,v 1.8 2013/03/01 18:26:10 joerg Exp $     */
+/*     $NetBSD: nbperf-bdz.c,v 1.9 2014/04/30 21:04:58 joerg Exp $     */
 /*-
  * Copyright (c) 2009, 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: nbperf-bdz.c,v 1.8 2013/03/01 18:26:10 joerg Exp $");
+__RCSID("$NetBSD: nbperf-bdz.c,v 1.9 2014/04/30 21:04:58 joerg Exp $");
 
 #include <err.h>
 #include <inttypes.h>
@@ -240,7 +240,7 @@
        fprintf(nbperf->output,
            "\tidx2 = idx - holes64[idx >> 6] - holes64k[idx >> 16];\n"
            "\tidx2 -= popcount64(g1[idx >> 6] & g2[idx >> 6]\n"
-           "\t                   & (((uint64_t)1 << idx) - 1));\n"
+           "\t                   & (((uint64_t)1 << (idx & 63)) - 1));\n"
            "\treturn idx2;\n");
 
        fprintf(nbperf->output, "}\n");



Home | Main Index | Thread Index | Old Index