3 ms·
In C, multiplying two unsigned shorts together can lead to undefined behaviour.
by rssoconnor 5y ago
In C, multiplying two unsigned shorts together can lead to undefined behaviour.
- josephcsible 5y agoIn case it's not obvious how this can happen, it's because the promotion rules can turn them into signed ints, and if they're big enough the product can overflow that. For more details, see https://cryptoservices.github.io/fde/2018/11/30/undefined-behavior.html https://cryptoservices.github.io/fde/2018/11/30/undefined-be...