Re: [PATCH v2] fs: O_* bit numbers uniqueness check

From: Roland Dreier
Date: Wed Jan 06 2010 - 02:30:41 EST



> Yeah, I chose the boot time check because of hweight32()..

One could do something like

#define HWEIGHT32(x) (!!((x) & (1u << 0)) +
!!((x) & (1u << 1)) +
//...
!!((x) & (1u << 31)));

that would probably work with BUILD_BUG_ON().

But as I said maybe it's too ugly.

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/