"Ronald S. Bultje" <rsbul...@gmail.com> writes: > Hi, > > 2011/4/7 Benjamin Larsson <ba...@ludd.ltu.se>: >> +static inline int32_t mul32(int32_t a, int32_t b) >> +{ >> + /* on >=i686, gcc compiles this into a single "imull" instruction */ >> + int64_t r = (int64_t)a * b; >> + /* round the result before truncating - improves accuracy */ >> + return (r + 0x80000000) >> 32; >> +} > > I believe this is what the MUL64() macro is for, then it works on > non-x86 archs also, but that doesn't round...
ARM has a rounding version of that instruction FWIW. -- Måns Rullgård m...@mansr.com _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel