Source-Changes-HG archive

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

[src/trunk]: src/sys/sys PR/53081: Fix size of the shift to depend on the typ...



details:   https://anonhg.NetBSD.org/src/rev/68b5be8b88f5
branches:  trunk
changeset: 321274:68b5be8b88f5
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 08 20:32:32 2018 +0000

description:
PR/53081: Fix size of the shift to depend on the type of the bitmap so that
we get the correct width.

diffstat:

 sys/sys/bitops.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 99a767863148 -r 68b5be8b88f5 sys/sys/bitops.h
--- a/sys/sys/bitops.h  Thu Mar 08 18:48:25 2018 +0000
+++ b/sys/sys/bitops.h  Thu Mar 08 20:32:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitops.h,v 1.13 2018/03/08 10:06:18 mrg Exp $  */
+/*     $NetBSD: bitops.h,v 1.14 2018/03/08 20:32:32 christos Exp $     */
 
 /*-
  * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -304,7 +304,7 @@
 #define __BITMAP_SIZE(__t, __n) \
     (((__n) + (__BITMAP_BITS(__t) - 1)) / __BITMAP_BITS(__t))
 #define __BITMAP_BIT(__n, __v) \
-    (1ul << ((__n) & __BITMAP_MASK(*(__v)->_b)))
+    ((__typeof__((__v)->_b[0]))1 << ((__n) & __BITMAP_MASK(*(__v)->_b)))
 #define __BITMAP_WORD(__n, __v) \
     ((__n) >> __BITMAP_SHIFT(*(__v)->_b))
 



Home | Main Index | Thread Index | Old Index