bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] Re: base64


From: Jim Meyering
Subject: Re: [bug-gnulib] Re: base64
Date: Thu, 25 Nov 2004 15:25:34 +0100

Stepan Kasal <address@hidden> wrote:
> Perhaps you'll find the macro more readable this way:
>
> #define BASE64_CEILING_DIV(n, k)  (n + (k-1)) / k
> #define BASE64_LENGTH(inlen)  BASE64_CEILING_DIV(inlen, 3) * 4

There should be parentheses around each RHS:

  #define BASE64_CEILING_DIV(n, k) ((n + (k-1)) / k)
  #define BASE64_LENGTH(inlen) (BASE64_CEILING_DIV(inlen, 3) * 4)

otherwise, using either macro in an expression like
`2 * BASE64_CEILING_DIV(3)' will give an incorrect result.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]