4 ms·
As pavlov said, it's readable enough to many (those that understand bitfields). It's literally current size + (current size/8) + fiddle ( the fiddle is there
by defrost 3y ago
As pavlov said, it's readable enough to many (those that understand bitfields).
It's literally current size + (current size/8) + fiddle
( the fiddle is there to prevent a fail to increase for small input (exercise for reader?) )
followed by a mask to ensure a multiple of 8.
The rational would be no floating point ops and all the weirdness that can entail plus the speed of raw shift | addition | mask.
You're correct that it deserves a twice over as the fiddle raises an eyebrow that invites investigation across inputs.