如何证明通过转移2 ^ N左逻辑乘法? [英] How to show that Shift Left Logical multiplies by 2^n?

查看:119
本文介绍了如何证明通过转移2 ^ N左逻辑乘法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到右移逻辑由2 ^划分数n,我做了下面来证明这一点。

I read that Shift Right Logical divides the number by 2^n and I did the below to prove it.

srl $t2,$t1,1

  $t1:  10100111  :  167
  $t2:  01010011  :  83

另外,我读了移位2 ^ N左逻辑乘法。不过,我不能显示这一点。

Also, I read that Shift Left Logical multiplies by 2^n. However I can not show this.

sll $t2,$t1,1

  $t1:  10100111  :  167
  $t2:  01001110  :  78

我是什么在这里失踪?

What am I missing here?

推荐答案

我要猜你在8位类型进行操作,这样你的左移值溢出。

I'm going to guess that you're operating on 8-bit types, so your left-shifted value overflows.


  • (167 * 2)= 334

  • (167 * 2) = 334

334%256 = 78

334 % 256 = 78

这篇关于如何证明通过转移2 ^ N左逻辑乘法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆