I have a 128-bit uint stored as two 64-bit uints and I need to add and multiply the latter to the former but I'm not really sure how to get started on this. Do I need to break the 128-bit number up into four 32-bit numbers and the 64-bit number into two 32-bit numbers or is there a quicker way to do this?
void
_add(
uint64_t x[2],
uint64_t y
) {
x[0] += y;
x[1] = ?
}
void
_multiply(
uint64_t x[2],
uint64_t y
) {
x[0] *= y;
x[1] = ?
}
Read more here: https://stackoverflow.com/questions/66322781/how-do-i-manually-multiply-and-add-to-a-128-bit-number-by-a-64-bit-number
Content Attribution
This content was originally published by Anthony at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.