> Fellows, > I'm just wondering if: > 1. Somebody uses -mcall-shifts? > 2. Will it be better to perform shifts left of a variable as a multiplication > under certain circumstances? For example, following operations will be > performed better via multiplicaion, providing HW multiplier exists: > > char a << [numb] > where numb are 3,4,5,6,7 > > int a << [numb] > where numb are [3-7] [10-15] > > long a << [numb] > where numb are [8-15] [20-31] > > > What do you think? > > ~d >
Is it not better to perform some of these using right-rotates and masking? For example, left-shifting a char by 7 could be done by a right-rotate of 1, then anding with 0x80. The same sort of thing can be done with ints and longs too. Also, for ints and longs, you can use the byte-swap instruction and masking for doing jumps of 8.
