在这最后一节,我们将看一些 Yul 中相对较少使用的指令。
虽然在之前的课中我们已经涵盖了 Yul 的大部分常用指令,但这次我们会简要介绍那些使用频率较低的指令,为本系列课程画上句号。
指令 | 描述 |
---|---|
sdiv(x, y) |
x / y , for signed numbers in two’s complement, 0 if y == 0 |
smod(x, y) |
x % y , for signed numbers in two’s complement, 0 if y == 0 |
slt(x, y) |
1 if x < y , 0 otherwise, for signed numbers in two’s complement |
sgt(x, y) |
1 if x > y , 0 otherwise, for signed numbers in two’s complement |
sar(x, y) |
signed arithmetic shift right y by x bits |
signextend(i, x) |
sign extend from (i*8+7)th bit counting from least significant |
addmod(x, y, m) |
(x + y) % m with arbitrary precision arithmetic, 0 if m == 0 |
mulmod(x, y, m) |
(x * y) % m with arbitrary precision arithmetic, 0 if m == 0 |
byte(n, x) |
nth byte of x , where the most significant byte is the 0th byte |
stop() |
stop execution, identical to return(0, 0) |
invalid() |
end execution with invalid instruction |
sdiv(x, y)
y == 0
,结果返...如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!