3 ms·
> If the buffer doesn't have a width of 256, 65536, or 4294967296, then you're out of luck Why so much hyperbole? You’re not out of luck. You can atomic increm
by epcoa 3y ago
> If the buffer doesn't have a width of 256, 65536, or 4294967296, then you're out of luck
Why so much hyperbole?
You’re not out of luck. You can atomic increment/add the unsigned no matter the buffer size. You don’t worry about overflow like you would with a signed type. You can mask after.
And you continue to avoid answering the simple question: what is the advantage of the signed type. I’ve already outlined the one with unsigned, especially with atomics.
- kazinator 3y agoComment said "why clutter with extra masking" (just use the unsigned types). Although unsigned types have no overflow, running to them as some sort of safe refuge is a mistaken knee-jerk reaction.