10の割り算 割られる数が1000ぐらいまで正しい(おまけ3)
補足
M0/M0+は、32x32の乗算器を持っている
2桁の掛け算のようなもの
いろいろ
たぶん、わからな過ぎて、ねむくなる?
オンラインコンパイラ
#include <iostream>
using namespace std;
int main(void){
// Your code here!
int x = (1<<16)+2; //65538
int y = (3<<16)+4; //196612
// 4 8
// 3 6
// 3 10 8
// 12885557256
// 3000A0008H
int xh = x >>16;
int xl = x & 0xffff;
int yh = y >>16;
int yl = y & 0xffff;
int e1 = xl * yl; //2x4=8
int e2 = (xl*yh)+(xh*yl); //(2x3)(1x4)=10;
int e3 = xh * yh; //1x3=3
long long r1 = ((long long)e3<<32) + ((long long)e2<<16) + (long long)e1;
printf(" %ld\n",r1);
printf(" %lx\n",r1);
printf("(%lx)\n", (long)( ((long)x) * ((long)y) ) );
}
結果
12885557256
3000a0008
(3000a0008)