Index: [thread] [date] [subject] [author]
  From: Sven <luther@dpt-info.u-strasbg.fr>
  To  : ggi-develop@eskimo.com
  Date: Thu, 3 Sep 1998 16:15:01 +0200 (MET DST)

Re: libggi not working ...

> Autoconf defines WORDS_BIGENDIAN on a big endian system. Should be the
cleanest way.

yes that would be very nice, and autoconf would permit to configure other things nicel also ...

> Something like that:
> union
> {
>         int IntPart;
>         char FirstByte;
> } TestEndian;
> TestEndian.IntPart = 0x4711;
> if (TestEndian.FirstByte == 0x11)
>         LittleEndian = true;


or :

#ifndef ARCH_SIXTYFOUR
long intval = 0x41424344L;
char * bigendian = "ABCD";
char * littleendian = "DCBA";
#else
long intval = 0x4142434445464748L;
char * bigendian = "ABCDEFGH";
char * littleendian = "HGFEDCBA";
#endif

main(void)
{
  long n[2];
  char * p;

  n[0] = intval;
  n[1] = 0;
  p = (char *) n;
  if (strcmp(p, bigendian) == 0)
    exit(0);
  if (strcmp(p, littleendian) == 0)
    exit(1);
  exit(2);
}

(just take note, the above is not turlly free source, itis part of a program who only authorize modification in patch form)

Friendly,

Sven LUTHER

Index: [thread] [date] [subject] [author]