Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/sys Pull up following revision(s) (requested by mrg i...
details: https://anonhg.NetBSD.org/src/rev/4ae0d11de06f
branches: netbsd-7
changeset: 800447:4ae0d11de06f
user: martin <martin%NetBSD.org@localhost>
date: Wed Mar 21 11:08:05 2018 +0000
description:
Pull up following revision(s) (requested by mrg in ticket #1582):
sys/sys/bitops.h: revision 1.12
sys/sys/bitops.h: revision 1.13
sys/sys/bitops.h: revision 1.14
fix sign issues
use 1ul for a left shift that may be greater than int sized.
noticed by martin.
fixes PR#53081.
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 | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (29 lines):
diff -r 093c58d49358 -r 4ae0d11de06f sys/sys/bitops.h
--- a/sys/sys/bitops.h Wed Mar 21 11:03:45 2018 +0000
+++ b/sys/sys/bitops.h Wed Mar 21 11:08:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bitops.h,v 1.11 2012/12/07 02:27:58 christos Exp $ */
+/* $NetBSD: bitops.h,v 1.11.12.1 2018/03/21 11:08:05 martin Exp $ */
/*-
* Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -271,8 +271,8 @@
_l = fls32(_div - 1);
_mt = (uint64_t)(0x100000000ULL * ((1ULL << _l) - _div));
*_m = (uint32_t)(_mt / _div + 1);
- *_s1 = (_l > 1) ? 1 : _l;
- *_s2 = (_l == 0) ? 0 : _l - 1;
+ *_s1 = (_l > 1) ? 1U : (uint8_t)_l;
+ *_s2 = (_l == 0) ? 0 : (uint8_t)(_l - 1);
}
/* ARGSUSED */
@@ -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)))
+ ((__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