小编Ast*_*lus的帖子

如何将unsigned long int(32位)拆分为8个半字节?

如果我的问题令人困惑,我很抱歉,但这是我想要做的例子,

让我说我有一个无符号long int = 1265985549二进制我可以把它写成01001011011101010110100000001101

现在我想把这个二进制32位数分成4位,就像这样,分别在这4位上工作

0100 1011 0111 0101 0110 1000 0000 1101

任何帮助,将不胜感激.

c++ binary bit-manipulation bitwise-operators

2
推荐指数
1
解决办法
2117
查看次数

在 MIPS 中将浮点数除为整数

我在两个 $t 寄存器中加载了一个浮点双精度数,现在我想将它除以 (-4)(不使用 fp 指令)并将其存储回 $f 寄存器。

mfc1 $t0, $f0  #$f0 = 0x00000000
mfc1 $t1, $f1  #$f1 = 0x40240000
div $t1, $t1, -4
mfhi $t0 #move the remainder to $t0
mflo $t1 #move the quotient to $t1

mtc1 $t0, $f0
mtc1 $t1, $f1


# store the $f0 result in memory
# print X/(-4)


mov.d $f12, $f0
li $v0, 3
syscall
Run Code Online (Sandbox Code Playgroud)

但这给出了非常意外的结果,即 -2.231744757682269E231

任何帮助将不胜感激。

floating-point assembly mips cpu-registers

1
推荐指数
1
解决办法
1756
查看次数