by aidenn0 · 11y ago · 0 comments
For an actual example:
uint32_t combineTwoUint16(uint16_t x, uint16_t y)
{
return x<<16 | y;
}
If int is larger than 16 bits, then this is technically undefined behavior in the case that x is greater than 2^15 as it's signed integer overflow. return (x+0U)<<16 | (y+0U);
Would it be insane to have a inline library for every arithmetic operation, that would handle such cases and offer addition optional functionality?