Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 01:59:55 UTC 2021

Modified Files:
        src/sys/external/bsd/common/include/linux: bitops.h

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

Author: Maya Rashish <m...@netbsd.org>


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/linux/bitops.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/common/include/linux/bitops.h
diff -u src/sys/external/bsd/common/include/linux/bitops.h:1.12 src/sys/external/bsd/common/include/linux/bitops.h:1.13
--- src/sys/external/bsd/common/include/linux/bitops.h:1.12	Sun Dec 19 01:54:12 2021
+++ src/sys/external/bsd/common/include/linux/bitops.h	Sun Dec 19 01:59:55 2021
@@ -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 @@ sign_extend64(uint64_t x, unsigned n)
 	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))

Reply via email to