Source-Changes-HG archive

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

[src/trunk]: src/sys/sys use 1ul for a left shift that may be greater than in...



details:   https://anonhg.NetBSD.org/src/rev/24097a1f8c52
branches:  trunk
changeset: 321267:24097a1f8c52
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Mar 08 10:06:18 2018 +0000

description:
use 1ul for a left shift that may be greater than int sized.
noticed by martin.

fixes PR#53081.

diffstat:

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

diffs (18 lines):

diff -r 8b0ce85558eb -r 24097a1f8c52 sys/sys/bitops.h
--- a/sys/sys/bitops.h  Thu Mar 08 07:54:14 2018 +0000
+++ b/sys/sys/bitops.h  Thu Mar 08 10:06:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitops.h,v 1.12 2017/01/12 19:03:09 christos Exp $     */
+/*     $NetBSD: bitops.h,v 1.13 2018/03/08 10:06:18 mrg 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) \
-    (1 << ((__n) & __BITMAP_MASK(*(__v)->_b)))
+    (1ul << ((__n) & __BITMAP_MASK(*(__v)->_b)))
 #define __BITMAP_WORD(__n, __v) \
     ((__n) >> __BITMAP_SHIFT(*(__v)->_b))
 



Home | Main Index | Thread Index | Old Index