tech-userlevel archive

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

Re: aligned_alloc c11 function

> (On all real platforms, MIN_ALIGNMENT == sizeof(void *)

Only for strange values of "real".  Platforms where sizeof(void *) is
not a power of two predate C (and are part of the reason why C has that
latitude built into it).

Perhaps all, what was the phrase, "industrially relevant" platforms....

> but a purist might want to use compile-time log2 macros to compute

How does one do that?  I've never managed to figure out a way to
compute lg - neither floor(lg(x)) nor ceil(lg(x)) - at compile time,
unless you count looping by conditionally multiply #including a file
(and that won't work here, because the argument is a sizeof return
value, which is not a preprocessor constant).  What have I missed?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index