tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: aligned_alloc c11 function
Date: Thu, 5 Nov 2015 18:24:36 -0800
From: Dennis Ferguson <dennis.c.ferguson%gmail.com@localhost>
Message-ID: <868C6B45-9254-4829-B035-BE9A186C211E%gmail.com@localhost>
| That said, I do think this should be done your way for functional reasons.
| Your code does what I think is the right thing in the case where both size
| and alignment are zero-valued, but the while() loop code probably doesn't.
0 is not a power of two, and hence is invalid as the alignment,
according to the proposed interface spec. It also makes no sense.
What's more, the code already checks for that, and returns EINVAL if
alignment == 0, so the while loop doesn't need to worry about that case.
Aside from that, I agree with everything else you said.
kre
ps: as to saving cpu cycles being important - this discussion (and
everything associated with it) has already wasted far more cpu cycles than
could ever be regained by replacing the while loop with the if variant.
Home |
Main Index |
Thread Index |
Old Index