1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 // -*- c++ -*- 19 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 20 21 // O S C L B Y T E O R D E R U T I L S 22 23 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 24 25 /*! \addtogroup osclbase OSCL Base 26 * 27 * @{ 28 */ 29 30 31 /*! \file oscl_byte_order.h 32 \brief This file defines functions providing byte ordering utility (e.g., switching between big and little endian orders). 33 */ 34 35 36 #ifndef OSCL_BYTE_ORDER_H_INCLUDED 37 #define OSCL_BYTE_ORDER_H_INCLUDED 38 39 #ifndef OSCL_BASE_H_INCLUDED 40 #include "oscl_base.h" 41 #endif 42 43 44 //! Convert little endian to host format. 45 /*! 46 This function takes a buffer of data which is assumed to be in little endian order and 47 rearranges it to the native order of the machine running the code. If the machine is a 48 little endian machine, nothing is done. 49 \param data A pointer to the input/output buffer 50 \param size The number of bytes in the buffer. 51 */ 52 void little_endian_to_host(char *data, uint32 size); 53 54 //! Convert host to little endian format. 55 /*! 56 This function takes a buffer of data which is assumed to be in the host's native order and 57 rearranges it to the little endian format. If the machine is a little endian machine, nothing is done. 58 \param data A pointer to the input/output buffer 59 \param size The number of bytes in the buffer. 60 */ 61 void host_to_little_endian(char *data, unsigned int size); 62 63 //! Convert big endian to host format. 64 /*! 65 This function takes a buffer of data which is assumed to be in big endian order and 66 rearranges it to the native order of the machine running the code. If the machine is a 67 big endian machine, nothing is done. 68 \param data A pointer to the input/output buffer 69 \param size The number of bytes in the buffer. 70 */ 71 void big_endian_to_host(char *data, unsigned int size); 72 73 //! Convert host to big endian format. 74 /*! 75 This function takes a buffer of data which is assumed to be in native host order and 76 rearranges it to big endian format. If the machine is a big endian machine, nothing is done. 77 \param data A pointer to the input/output buffer 78 \param size The number of bytes in the buffer. 79 */ 80 void host_to_big_endian(char *data, unsigned int size); 81 82 #if (!OSCL_DISABLE_INLINES) 83 #include "oscl_byte_order.inl" 84 #endif 85 86 /*! @} */ 87 88 #endif 89