3 ms·
Counterpoint… it’s a bit verbose when you need to cast for bitwise operations. uint32_t packed = ((uint32_t)x << 16) | ((uint32_t)y & 0
by klodolph 7y ago
Counterpoint… it’s a bit verbose when you need to cast for bitwise operations.
uint32_t packed = ((uint32_t)x << 16)
| ((uint32_t)y & 0xffff);
uint32_t packed = (static_cast<uint32_t>(x) << 16)
| (static_cast<uint32_t>(y) & 0xffff);
The verbosity of static_cast can get out of hand, and make it harder to read.
- deleted 7y ago[deleted]