On Wed, May 22, 2019 at 09:45:46PM +0200, Reimar Döffinger wrote: > On Tue, May 21, 2019 at 09:30:54PM +0200, Reimar Döffinger wrote: > > > +#define SHIFT(v, shift) ((v) >> (shift)) > > > +#define ABS_SHIFT(v, shift) ((v) > 0 ? SHIFT(v, shift) : -SHIFT(-v, > > > shift)) > > > > Don't we have something like that already? > > Seems we don't > > > I think this should rather be: > > (v - (v >> 31)) >> shift > > ? > > Not right for shift > 1. > But this one according to my testing is equivalent: > ((a + (a >> 31)) >> b) - (a >> 31) > Not certain it will be fewer instructions, > but it is branchless.
> On some ISAs the simple > a / (1 << b) this is best, and the compiler can decode. thanks. -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".