我需要在c ++中将索引(PC)位的最高n位转换为索引(PC)位的最低n位。
这是索引(PC)位中最高n位的代码;
PCmask_gshare = (1073741823 >> ( 30 - (index_bits_gshare - history_bits)) ); //For m-n bits in gshare
Hmask = (1073741823 >> (30 - history_bits) ); //For n bits in gshare.
p = history_table ^ ( (address >> ( 2 + index_bits - history_bits)) & Hmask );
index = (p << (index_bits - history_bits)) + ((address >> 2) & PCmask_gshare );
如何将其转换为最低的n位(history_bits)?