Leptonica 1.68
C Image Processing Library

endiantest.c

Go to the documentation of this file.
00001 /*====================================================================*
00002  -  Copyright (C) 2001 Leptonica.  All rights reserved.
00003  -  This software is distributed in the hope that it will be
00004  -  useful, but with NO WARRANTY OF ANY KIND.
00005  -  No author or distributor accepts responsibility to anyone for the
00006  -  consequences of using this software, or for whether it serves any
00007  -  particular purpose or works at all, unless he or she says so in
00008  -  writing.  Everyone is granted permission to copy, modify and
00009  -  redistribute this source code, for commercial or non-commercial
00010  -  purposes, with the following restrictions: (1) the origin of this
00011  -  source code must not be misrepresented; (2) modified versions must
00012  -  be plainly marked as such; and (3) this notice may not be removed
00013  -  or altered from any source or modified source distribution.
00014  *====================================================================*/
00015 
00016 /* 
00017  *    endiantest.c
00018  *
00019  *    This test was contributed by Bill Janssen.  When used with the
00020  *    gnu compiler, it allows efficient computation of the endian
00021  *    flag as part of the normal compilation process.  As a result,
00022  *    it is not necessary to set this flag either manually or
00023  *    through the configure Makefile generator.
00024  */
00025 
00026 #include <stdio.h>
00027 
00028 int main()
00029 {
00030 /* fprintf(stderr, "doing the test\n"); */
00031     long v = 0x04030201;
00032     if (*((unsigned char *)(&v)) == 0x04)
00033         printf("L_BIG_ENDIAN\n");
00034     else
00035         printf("L_LITTLE_ENDIAN\n");
00036     return 0;
00037 }
00038 
00039 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines