【ICS计算机系统】位运算Lab1
ICS-LAB1-Report
Bits.c
1. bitAnd–与
题目:
只用~和|实现&
样例:
bitAnd(6, 5) = 4
可使用操作: ~ |
最大操作数限制: 8
使用操作数: 4
int bitAnd(int x, int y) {
return ~(~x | ~y); //De Morgan's laws
}
应用摩根律 ~(x | y) = ~x & ~y, 可得 x & y = (x | ~y)
2. getByte–获取字节
题目:
从x
原创
2020-10-17 12:18:19 ·
3612 阅读 ·
0 评论