]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/config/auto-aux/endian.c
Inital import
[l4.git] / l4 / pkg / ocaml / contrib / config / auto-aux / endian.c
1 /***********************************************************************/
2 /*                                                                     */
3 /*                           Objective Caml                            */
4 /*                                                                     */
5 /*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         */
6 /*                                                                     */
7 /*  Copyright 1996 Institut National de Recherche en Informatique et   */
8 /*  en Automatique.  All rights reserved.  This file is distributed    */
9 /*  under the terms of the GNU Library General Public License, with    */
10 /*  the special exception on linking described in file ../../LICENSE.  */
11 /*                                                                     */
12 /***********************************************************************/
13
14 /* $Id: endian.c 4144 2001-12-07 13:41:02Z xleroy $ */
15
16 #include "m.h"
17
18 #ifndef ARCH_SIXTYFOUR
19 long intval = 0x41424344L;
20 char * bigendian = "ABCD";
21 char * littleendian = "DCBA";
22 #else
23 long intval = 0x4142434445464748L;
24 char * bigendian = "ABCDEFGH";
25 char * littleendian = "HGFEDCBA";
26 #endif
27
28 main(void)
29 {
30   long n[2];
31   char * p;
32
33   n[0] = intval;
34   n[1] = 0;
35   p = (char *) n;
36   if (strcmp(p, bigendian) == 0)
37     exit(0);
38   if (strcmp(p, littleendian) == 0)
39     exit(1);
40   exit(2);
41 }