我正在实现一个多精度模块,此时我被困在乘法中。
要执行我的算法,我需要使用 Haswell 微架构将两个 64 位的无符号操作数相乘,并将结果存储在内存块中。我正在使用“g++”进行一个实现,而另一个使用“icpc”的效率更高。
int main(){
//Operands
size_t a = 10000000000000000000 //Fit in 8 bytes
b = 7;
//To store the result;
size_t dst[2];
//Multiplication here... (Note that the multiplication result don't fit in 64bits. So, I need to save the result in two memory positions)
dst[0] = //Store the less significative half..
dst[1] = //Store the more significative half..
//My function
print_To_Screen(dst);
}
我不知道如何访问结果的每一半以将它们存储在我想要的内存块中。我是否必须使用汇编指令进行乘法运算并使用它们来存储结果,还是存在一种简单的方法?