以下答案均由个人完成转载注明出处
2.63
int sra(int x, int k) {
intxrsl = (unsigned) x >> k;
intx_bit = 8 * sizeof ( int );
intsub_initial = x_bit - w;
if( x < 0 )
for( int i = 0; i < w; i ++ )
xrsl+= (int) pow (2, (sub_initial++) - 1 );
returnxrsl;
}
int srl(int x, int k) {
unsignedxrsa = (int) x >> k;
intx_bit = 8 * sizeof ( int );
intsub_initial = x_bit - w;
if( x < 0 )
for( int i = 0; i < w; i ++ )
xrsa-= (int) pow (2, (sub_initial++) - 1 );
returnxrsa;
}
2.75
//函数们
int signed_high_prod(x, y)(int x, int y) {
longlong int actual = x * y;
return(unsigned)actual >> 32;
}
unsigned unsigned_high_prod( unsigned x, unsignedy) {
int w = sizeof ( int ) << 3;
returnsigned_high_prod(x, y) + (x>>(w-1)) * y + x * (y>>(w-1)) ;
}
2.81
A 错
如果 x 是1, y 是最小值, 那么 -y 依然是最小值, 此时-x > -y
B 正确
31 * y + 33 * x = (32 – 1) * y + ( 32 + 1) *x = ((x+y)<<5) + x -y
C错误
当x = -1, y = 1
~x + ~y = 0xFFFFFFFE
(x+y) = 0xFFFFFFFF
D对
位级表示相同
E相当于减一
2.86
描述HexMEV
-00x8000000
最小的值>10x3F01257/2560257 * 2^(-8)
2560x470018256
-∞0xFF00
最大的非规格数0x00FF255/256-62255/256 * 2 (-62)
十六进制表示为3AA0的数0x3Aaa0416/256-5416 * 2 ^ (-13)
2.90
A 0 10000000 10010010000111111101011
B 11.00100100100…
C第9位开始不同的
网友评论