pendian.h

00001 /*---------------------------------------------------------------------------*
00002  *  pendian.h  *
00003  *                                                                           *
00004  *  Copyright 2007 Nuance Communciations, Inc.                               *
00005  *                                                                           *
00006  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
00007  *  you may not use this file except in compliance with the License.         *
00008  *                                                                           *
00009  *  You may obtain a copy of the License at                                  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0                           *
00011  *                                                                           *
00012  *  Unless required by applicable law or agreed to in writing, software      *
00013  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
00014  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 
00015  *  See the License for the specific language governing permissions and      *
00016  *  limitations under the License.                                           *
00017  *                                                                           *
00018  *---------------------------------------------------------------------------*/
00019 
00020 #ifndef PENDIAN_H
00021 #define PENDIAN_H
00022 
00023 
00024 
00025 #include "PortPrefix.h"
00026 #include "ptypes.h"
00027 
00028 #ifdef __sgi
00029 /*   */#include <sys/endian.h>
00030 
00031 #elif defined(__sparc)
00032 /*   */#include <sys/isa_defs.h>
00033 /*   */#ifdef __LITTLE_ENDIAN
00034 /*   *//* */#define __LITTLE_ENDIAN 1234
00035 /*   *//* */#define __BYTE_ORDER __LITTLE_ENDIAN
00036 /*   */#elif defined(_BIG_ENDIAN)
00037 /*   *//* */#define __BIG_ENDIAN 4321
00038 /*   *//* */#define __BYTE_ORDER __BIG_ENDIAN
00039 /*   */#endif
00040 
00041 #elif defined(ANDROID)
00042 
00043 /*  */#ifdef HAVE_ENDIAN
00044 /*  */#include <endian.h>
00045 
00046 /*  */#elif defined(HAVE_LITTLE_ENDIAN)
00047 /*  *//*   */#define __LITTLE_ENDIAN 1234
00048 /*  *//*   */#define __BYTE_ORDER __LITTLE_ENDIAN
00049 
00050 /*  */#elif defined(HAVE_BIG_ENDIAN)
00051 /*  *//*   */#define __BIG_ENDIAN 4321
00052 /*  *//*   */#define __BYTE_ORDER __BIG_ENDIAN
00053 
00054 /*  */#endif
00055 
00056 #elif defined (__linux)
00057 /*       */#include <endian.h>
00058 
00059 #elif defined(__FreeBSD__) || defined(_decunix_)
00060 /*   */#include <machine/endian.h>
00061 
00062 #elif defined(__i386) || defined(_M_IX86)
00063 /*   */#undef  __LITTLE_ENDIAN
00064 /*   */#define __LITTLE_ENDIAN 1234
00065 /*   */#define __BYTE_ORDER __LITTLE_ENDIAN
00066 
00067 #elif defined(_sh4_)||defined(SH4)
00068 /*   */#if defined (__vxworks)
00069 /*   *//* */#if _BYTE_ORDER == _LITTLE_ENDIAN   /* VxWorks defines _BYTE_ORDER and _LITTLE_ENDIAN */
00070 /*   *//* *//* */#undef __LITTLE_ENDIAN
00071 /*   *//* *//* */#define __LITTLE_ENDIAN  1234
00072 /*   *//* *//* */#define __BYTE_ORDER  __LITTLE_ENDIAN
00073 /*   *//* */#elif _BYTE_ORDER == _BIG_ENDIAN    /* VxWorks defines _BYTE_ORDER and _BIG_ENDIAN */
00074 /*   *//* *//* */#undef __BIG_ENDIAN
00075 /*   *//* *//* */#define __BIG_ENDIAN  4321
00076 /*   *//* *//* */#define __BYTE_ORDER  __BIG_ENDIAN
00077 /*   *//* */#else
00078 /*   *//* *//* */#error
00079 /*   *//* */#endif
00080 /*   */#else
00081 /*   *//* */#error "Could not determine endianness of the machine Unknown OS for SH4 Chip."
00082 /*   */#endif
00083 
00084 #else
00085 /*   */#error "Could not determine endianness of the machine Chip Not Known."
00086 #endif
00087 
00088 
00102 PORTABLE_API void swap_byte_order(void *buffer,
00103                                   size_t count,
00104                                   size_t itemSize);
00105                                   
00110 #endif 

Generated on Thu May 1 15:37:25 2008 for SREC by  doxygen 1.5.3