[FFmpeg-devel] [PATCH] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT
ferdnyc at gmail.com
Tue Jan 22 04:32:46 EET 2019
On Mon, Jan 21, 2019 at 3:54 PM James Almer <jamrial at gmail.com> wrote:
> On 1/21/2019 4:09 PM, FeRD (Frank Dana) wrote:
> > diff --git a/libavutil/common.h b/libavutil/common.h
> > index 8db0291170..0bff7f8f72 100644
> > --- a/libavutil/common.h
> > +++ b/libavutil/common.h
> > @@ -51,7 +51,7 @@
> > #endif
> > //rounded division & shift
> > -#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) +
> > +#define ROUNDED_RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) :
> ((a) + ((1<<(b))>>1)-1)>>(b))
> common.h is a public installed library, so this would be an API break.
> There's also no good way to deprecate a define and replace it with
> another while informing the library user, so for something purely
> cosmetic like this i don't think it's worth the trouble.
Well... not *purely* cosmetic. See  for an example of one issue. Ruby's
also defines an `RSHIFT` macro, with different semantics (it doesn't
round), so when building code
which includes both headers the macro ends up being redefined.
That being said, I can definitely accept "still not worth the trouble".
More information about the ffmpeg-devel