blob: a4dc6ad431040ed525071c7e21276688221ae464 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
Sudo code for SMULT64X64:
let result be split into result0 and result1 where they correspond to the 64 LSBs and MSBs of result respectively.
void SMULT64X64(num0, num1, result) {
previousBit = 0;
result0 = num0;
for(int i = 0; i < 64; i++) {
currentBit = num0 & 1;
if(currentBit == 0 && previousBit == 1) {
result1 += num1;
} else if(currentBit == 1 && previousBit == 0) {
result1 -= num1;
}
result = result >> 1;
previousBit = currentBit;
}
}
|