以下答案均由個人完成轉(zhuǎn)載注明出處
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
//函數(shù)們
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錯誤
當(dāng)x = -1, y = 1
~x + ~y =??? 0xFFFFFFFE
(x+y) = 0xFFFFFFFF
D對
位級表示相同
E相當(dāng)于減一
2.86
描述HexMEV
-00x8000000
最小的值>10x3F01257/2560257 * 2^(-8)
2560x470018256
-∞0xFF00???
最大的非規(guī)格數(shù)0x00FF255/256-62255/256 * 2 (-62)
十六進制表示為3AA0的數(shù)0x3Aaa0416/256-5416 * 2 ^ (-13)
2.90
A 0 10000000 10010010000111111101011
B 11.00100100100…
C第9位開始不同的