Re: improvement of index-calculation




"Guenther Wimpassinger" <gw_spam@xxxxxxxxx> schrieb

>
> "Guenther Wimpassinger" <gw_spam@xxxxxxxxx> schrieb
>
> > mov ECX,[ESI+iShiftMaskY_sub_X_sub_Y32Bit]
> > shl EAX,CL // EAX := "masked y" shl
> > // iShiftMaskY_sub_X_sub_Y32Bit
>
> I have a small problem with the above statments. specially
> the shl. iShiftMaskY can be negativ. but shl treats cl always
> as an unsigned value and shift EAX 255 times left.
>
> do I have to check the and make a brachn like
>
> if EAX<0
> then
> neg cl
> shr eax,cl
> else
> shl eax,cl
>
> what is the most efficient way?
>

I have solved it this way, is there a better/shorter/faster way to do this?

TIA
Guenther


.