lldb
linux 调试工具
- 数字的临结时非常重要的,尤其是在重要的系统中
- using return to a sort of a modern technique called return to return oriented programming
移位操作:Shift Operations
- 左移:后面填充0:
0000 0001 << 2 0000 0100
- 右移:逻辑右移:最左端填充0,算数右移:最右端填充最高有效位
0000 1000 >> 3 0000 0001 1000 1000 >> 3 1111 0001
为什么要这么做?
原因:
无符号和有符号数字范围
示例以5位数字来表示: unsign num: 4 3 2 1 0 16 8 4 2 1 max: 1 1 1 1 1 -> 31 = 2w(次方) -1 min: 0 0 0 0 0 -> 0 Two's Complement Values: 4 3 2 1 0 16 8 4 2 1 max 0 1 1 1 1 -> 15 = 2(w-1)次方 -1 min 1 0 0 0 0 -> -16 =-2(w-1)次方
TMax: 2w-1 -1
TMin: -2w-1
UMax:2w-1
无符号数和有符号数运算时转换规则:
- 操作的变量全为有符号,则认为时有符号数运算
- 操作的变量只要有一个无符号数,则将其余有符号先转换为无符号数,再进行运算
文档更新时间: 2022-07-16 07:44 作者:admin