On Thu, 5 May 2016, Konstantin Belousov wrote:
On Wed, May 04, 2016 at 09:17:50PM -0700, John Baldwin wrote:
...
How about this:
...
diff --git a/sys/sys/_bitset.h b/sys/sys/_bitset.h
index 26a8848..89dd7b6 100644
--- a/sys/sys/_bitset.h
+++ b/sys/sys/_bitset.h
@@ -36,26 +36,15 @@
* Macros addressing word and bit within it, tuned to make compiler
* optimize cases when SETSIZE fits into single machine word.
*/
-#define _BITSET_BITS (sizeof(long) * NBBY)
+#define _BITSET_BITS (sizeof(long) * 8)
-#define __bitset_words(_s) (howmany(_s, _BITSET_BITS))
+#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
The _howmany symbol is still in the user namespace. Implementation-reserved
names are __.* and _[A-Z].* .
The names _.* also are reserved at file scope.
sys/select.h also uses _howmany(), and that is correct there since it is
only used in inner scopes that the application cannot conflict with
(except possibly via -Wshadow warnings). I haven't checked this in the
patch yet, but it is probably the same. In select.h, the inner scopes
are one inside a struct declaration and one inside a compound statement
in a statement-like macro.
I like to use minimal underscores since 2 underscores are uglier. select.h
does this perfectly or almost perfectly. An example of this is the
__fd_mask typedef. This is used in non-inner scopes so it needs 2
underscores.
The above fixes the bogus underscore on _s. 1 underscore is also ugly,
and this one shows lack of understanding of namespaces. Underscores
are never needed for macro parameters since they create their their
own namespace.
Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"