Remove undefined behaviors

This commit is contained in:
Justine Tunney 2021-05-16 11:16:28 -07:00
parent 4864565198
commit b3838173ec
51 changed files with 756 additions and 1302 deletions

View file

@ -29,9 +29,13 @@
*/
void(pmulhuw)(uint16_t a[8], const uint16_t b[8], const uint16_t c[8]) {
unsigned i;
uint32_t x;
uint16_t r[8];
for (i = 0; i < 8; ++i) {
r[i] = ((b[i] * c[i]) & 0xffff0000) >> 16;
x = b[i];
x *= c[i];
x >>= 16;
r[i] = x;
}
memcpy(a, r, 16);
}