Download kalc User`s Manual
Transcript
6.3.1 Shifts and rotations kalc includes a wide variety of commands for shifting and rotating the hexadecimal string bits. They all take into consideration the current word size (see section 6.2.) The available commands are: sl This command shifts the hxs one bit to the left. The most significant bit is lost. Here is an example, assuming the current word size is 4: 1: > sl 1: > sl 1: # 1011b # 110b # 1100b slb This command shifts the hxs one byte to the left. The most significant byte is lost. Here is an example, assuming the current word size is 32: 1: > slb 1: > slb 1: # CAFEBABEh # FEBABE00h # BABE0000h sr This command shifts the hxs one bit to the right. The least significant bit is lost. Here is an example, assuming the current wordsize is 4: 1: > sr 1: > sr 1: # 1101b # 110b # 11b asr This command does an arithmetic shift one bit to the right. The most significant bit is preserved in the operation. The least significant bit is lost. Here is an example, assuming the current word size is 4: 1: > asr 1: > asr 1: # 1010b # 1101b # 1110b srb This command shifts the hxs one byte to the right. The least significant byte is lost. Here is an example, assuming the current word size is 32: 15