主题:C语言&深入理解操作系统 2.43
只使用 位级 和 逻辑 运算,编写出C的表达式,在下列描述的条件下产生1,而在其它情况下得到0.你的代码应该能工作在任何字长的机器上。假设 x 是整数
A. x的任何位都等于1时
B. x的任何位都等于0时
C. x的最低有效字节中的位都等于1时。
D. x的最低有效字节中的位都等于0是。
请高手讲解,随便帮我翻译一下下面的文字,谢谢
The function does not perform any sign extension. For example, if we attempt to extract byte 0 from
word 0xFF, we will get 255, rather than**
B. The following code uses a well-known trick for using shifts to isolate a particular range of bits and to
perform sign extension at the same time. First, we perform a left shift so that the most significant bit
of the desired byte is at bit position 31. Then we right shift by 24, moving the byte into the proper
position and peforming sign extension at the same time.
A. x的任何位都等于1时
B. x的任何位都等于0时
C. x的最低有效字节中的位都等于1时。
D. x的最低有效字节中的位都等于0是。
请高手讲解,随便帮我翻译一下下面的文字,谢谢
The function does not perform any sign extension. For example, if we attempt to extract byte 0 from
word 0xFF, we will get 255, rather than**
B. The following code uses a well-known trick for using shifts to isolate a particular range of bits and to
perform sign extension at the same time. First, we perform a left shift so that the most significant bit
of the desired byte is at bit position 31. Then we right shift by 24, moving the byte into the proper
position and peforming sign extension at the same time.