3 ms·
I'm just happy that both C and C++ now have bit stuff like byteswap, popcount, rolr, etc. It was a bit silly that stuff like that wasn't in either standard unt
by Bigpet 4y ago
I'm just happy that both C and C++ now have bit stuff like byteswap, popcount, rolr, etc.
It was a bit silly that stuff like that wasn't in either standard until this recently.
- quelsolaar 4y agoThese this are much more complicated to define then you think when you consider the kinds of strange hardware C supports, where bytes are not 8 bits and things like that. We tried to get endian-ness conversion functions in to c23 but ran out of time just because defining these functions so that their functionality is clear on non standard hardware is so difficult.
- fanf2 4y agoIt would have been reasonable to define the functions only for the CHAR_BIT == 8 case, and if any implementers that support weird architectures want the functionality let them come forward with a proposal. I got the impression that the people working on the proposal got into an avoidable mess of complications.
- quelsolaar 4y agoGiven that weird platforms are so dependent on C and since we release versions so infrequent, we try to get it right the first time. Often even defining what is excluded becomes complicated.
- cbrogrammer 4y agoif C throws away portability it is no longer C
- pjmlp 4y agoC's secret to portability is called #ifdef spaghetti and mostrosities like autoconf.
- Bigpet 4y agooh, I didn't see that byteswap wasn't in there. I googled the "stdc_" part and saw a paper that included byteswap. I guess that was an older draft. Damn, so close. Well I hope it's included next time.
- __phantomderp 4y agoI'll do my best to get ror/rol and byteswap in!