[FFmpeg-cvslog] r23461 - trunk/libavutil/base64.h

Reimar Döffinger Reimar.Doeffinger
Fri Jun 4 18:32:58 CEST 2010


On Fri, Jun 04, 2010 at 12:57:25PM +0100, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> > On Fri, Jun 04, 2010 at 03:15:07AM +0200, hyc wrote:
> >> Author: hyc
> >> Date: Fri Jun  4 03:15:07 2010
> >> New Revision: 23461
> >> 
> >> Log:
> >> Add AV_BASE64_SIZE() macro
> >> 
> >> Modified:
> >>    trunk/libavutil/base64.h
> >> 
> >> Modified: trunk/libavutil/base64.h
> >> ==============================================================================
> >> --- trunk/libavutil/base64.h	Fri Jun  4 01:53:10 2010	(r23460)
> >> +++ trunk/libavutil/base64.h	Fri Jun  4 03:15:07 2010	(r23461)
> >> @@ -46,4 +46,9 @@ int av_base64_decode(uint8_t *out, const
> >>   */
> >>  char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
> >>  
> >> +/**
> >> + * Calculate the output size needed to base64-encode x bytes.
> >> + */
> >> +#define AV_BASE64_SIZE(x)  (((x)+2) / 3 * 4 + 1)
> >
> > I'd like to point out that I consider this a perfect example of
> > pointless use of a macro.  Or am I missing any advantage this has
> > over a static inline function?
> 
> Macro or inline function isn't important.  The important thing is to
> avoid repeating that obscure formula everywhere.  Do you disagree with
> that?

No, and given the other comments I guess it can't be replaced.
However I do think that functions have enough advantages over macros
that you should try to use them whenever possible.



More information about the ffmpeg-cvslog mailing list