0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

10の割り算 割られる数が1000ぐらいまで正しい(おまけ3)

Last updated at Posted at 2023-12-02

10の割り算 割られる数が1000ぐらいまで正しい(おまけ3)

補足
M0/M0+は、32x32の乗算器を持っている
2桁の掛け算のようなもの

いろいろ
たぶん、わからな過ぎて、ねむくなる?

o_cop823.jpg

オンラインコンパイラ



#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)


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?