00001 /* 00002 * $Id$ 00003 * 00004 * Copyright (C) 2008 iptelorg GmbH 00005 * 00006 * Permission to use, copy, modify, and distribute this software for any 00007 * purpose with or without fee is hereby granted, provided that the above 00008 * copyright notice and this permission notice appear in all copies. 00009 * 00010 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 00011 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 00012 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 00013 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00014 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00015 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00016 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00017 */ 00018 /* 00019 * endianness compile and runtime tests 00020 * 00021 * History: 00022 * -------- 00023 * 2008-06-13 created by andrei 00024 */ 00025 00033 #include "endianness.h" 00034 00035 int _endian_test_int=1 /* used for the runtime endian tests */; 00036 00037 00038 /* return 0 on success, -1 on error (compile time detected endianness is 00039 * different from run time) 00040 */ 00041 int endianness_sanity_check() 00042 { 00043 #ifdef __IS_LITTLE_ENDIAN 00044 return is_little_endian()-1; 00045 #elif defined __IS_BIG_ENDIAN 00046 return is_big_endian()-1; 00047 #else 00048 #warning BUG: endianness macro are not defined 00049 return -1; 00050 #endif 00051 } 00052
1.7.1