具体题目如下:/* * getByte - Extract byte n from word x* Bytes numbered from 0 (LSB) to 3 (MSB)* Examples:getByte(0x12345678,1) = 0x56* Legal ops:& ^ | + >* Max ops:6*/int getByte(int x,int n) {return 2;}

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 05:47:21
具体题目如下:/**getByte-Extractbytenfromwordx*Bytesnumberedfrom0(LSB)to3(MSB)*Examples:getByte(0x12345678,

具体题目如下:/* * getByte - Extract byte n from word x* Bytes numbered from 0 (LSB) to 3 (MSB)* Examples:getByte(0x12345678,1) = 0x56* Legal ops:& ^ | + >* Max ops:6*/int getByte(int x,int n) {return 2;}
具体题目如下:
/*
* getByte - Extract byte n from word x
* Bytes numbered from 0 (LSB) to 3 (MSB)
* Examples:getByte(0x12345678,1) = 0x56
* Legal ops:& ^ | + >
* Max ops:6
*/
int getByte(int x,int n) {
return 2;
}

具体题目如下:/* * getByte - Extract byte n from word x* Bytes numbered from 0 (LSB) to 3 (MSB)* Examples:getByte(0x12345678,1) = 0x56* Legal ops:& ^ | + >* Max ops:6*/int getByte(int x,int n) {return 2;}
从词x中取出第n(0~3)字节.
示例:从0x12345678中取出第1字节.
其中78是第0字节,56是第一字节,34是第二字节,12是第三字节,因为要求第一字节,所以取出0x56.
答案:
int getByte(int x,int n){return((x (8* n));}