Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/include/linux define BITS_PER_LONG. ...



details:   https://anonhg.NetBSD.org/src/rev/c16b4e127891
branches:  trunk
changeset: 1028156:c16b4e127891
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:59:55 2021 +0000

description:
define BITS_PER_LONG. use compiler-defined macro instead of sizeof.


Author: Maya Rashish <maya%NetBSD.org@localhost>

diffstat:

 sys/external/bsd/common/include/linux/bitops.h |  9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diffs (27 lines):

diff -r 7f7390ad6c07 -r c16b4e127891 sys/external/bsd/common/include/linux/bitops.h
--- a/sys/external/bsd/common/include/linux/bitops.h    Sun Dec 19 01:59:48 2021 +0000
+++ b/sys/external/bsd/common/include/linux/bitops.h    Sun Dec 19 01:59:55 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bitops.h,v 1.12 2021/12/19 01:54:12 riastradh Exp $    */
+/*     $NetBSD: bitops.h,v 1.13 2021/12/19 01:59:55 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -102,16 +102,11 @@
        return (int64_t)(x << (63 - n)) >> (63 - n);
 }
 
-/*
- * XXX Don't define BITS_PER_LONG as sizeof(unsigned long)*CHAR_BIT
- * because that won't work in preprocessor conditionals, where it often
- * turns up.
- */
-
 #define        BITS_TO_LONGS(n)                                                \
        roundup2((n), (sizeof(unsigned long) * CHAR_BIT))
 
 #define        BITS_PER_BYTE   NBBY
+#define        BITS_PER_LONG   (__SIZEOF_LONG__ * CHAR_BIT)
 
 #define        BIT(n)          ((unsigned long)__BIT(n))
 #define        BIT_ULL(n)      ((unsigned long long)__BIT(n))



Home | Main Index | Thread Index | Old Index