bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] Re: base64


From: Paul Eggert
Subject: Re: [bug-gnulib] Re: base64
Date: Sat, 27 Nov 2004 01:18:46 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Simon Josefsson <address@hidden> writes:

>> I guesss this table assumes ASCII.  Do you want your code to be
>> portable to EBCDIC hosts?
>
> If it is easy to do without run-time computation of the table, yes.
> But I don't know how to.

One possibility is to do something like this:

  #define B64_DECODE(x) \
    ((x) == 'A' ? 0 \
     : (x) == 'B' ? 1 \
     : (x) == 'C' ? 2 \
     : ... \
     : -1)

  static const signed char b64[0x100] = {
    B64_DECODE (0),
    B64_DECODE (1),
    ...
    B64_DECODE (255)
  };

A bit crude, but the only other ways that spring to mind involve using
Autoconf.




reply via email to

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