Subject: Re: changes to bit-twiddling macros & __arraycount()
To: David Young <dyoung@pobox.com>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 08/07/2006 21:19:53
dyoung@pobox.com said:
> Per previous discussions, I am moving the bit-twiddling macros [1] and
> __arraycount from lib/libkern/libkern.h to sys/cdefs.h
Sorry, I missed that.
> I have
> added a __-prefix to SHIFTIN & SHIFTOUT
What's the objective? I could imagine that you want to use it in userlevel
programs too, but then these would be highly unportable. So an extra
header and names without "__" prefix would be more reasonable.
And: It seems to me that the u_int32_t limitation is not technically
necessary. One could probably use "unsigned long" and get the longest
integer directly usable by the platform. Drawback would be that
people with 64-bit platforms could write non-partable code. Gain would
be that the macros could be used more effectively on 64-bit.
And: The "(__n) == 32)" should better be a ">=". ">=8*sizeof(long)"
if you follow my suggestion above.
best regards
Matthias