https://www.cs.cmu.edu/afs/cs/academic/class/15213-f15/www/schedule.html
https://www.bilibili.com/video/BV1iW411d7hd?p=1
15-213: Intro to Computer Systems: Schedule for Fall 2015
Lecture 02
Bits, Bytes, and Int
Bits, Bytes, and Int 在计算机中的表示和运算,包括移位操作、整型编码、符号转换、类型转换、扩展和截断
重点总结
有符号整数,负数使用补码表示,最高位为符号位,0 占用一个正数,所以正数比负数少一个
移位运算优先级,1 << 2 + 3 << 4 等价于 1 << (2 + 3) << 4
移动位数超过参数位数
- 一种实现是,移动位数取模,0x01 << 10, 10 mod 8 = 2