Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

endian.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2002 Xavier Trochu
00003 
00004 This software is provided 'as-is', without any express or implied warranty. In no event
00005 will the authors be held liable for any damages arising from the use of this software.
00006 
00007 Permission is granted to anyone to use this software for any purpose, including commercial
00008 applications, and to alter it and redistribute it freely, subject to the following
00009 restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you
00012    wrote the original software. If you use this software in a product, an acknowledgment
00013    in the product documentation would be appreciated but is not required.
00014 
00015 2. Altered source versions must be plainly marked as such, and must not be misrepresented 
00016    as being the original software.
00017 
00018 3. This notice may not be removed or altered from any source distribution.
00019 */
00020 #ifndef __ENDIAN_H_
00021 #define __ENDIAN_H_
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026 
00027 inline unsigned int from_big_endian(unsigned int src) {
00028     unsigned int a,b,c,d;
00029     a = (src & 0xFF);
00030     b = (src & 0xFF00) >> 8;
00031     c = (src & 0xFF0000) >> 16;
00032     d = (src & 0xFF000000) >> 24;
00033     return a << 24 | b << 16 | c << 8 | d;
00034 }
00035 
00036 inline unsigned short from_big_endian(unsigned short src) {
00037     unsigned short a,b;
00038     a = (src & 0xFF);
00039     b = (src & 0xFF00) >> 8;
00040     return a << 8 | b;
00041 }
00042 
00043 #endif

Generated on Fri Aug 9 22:54:29 2002 for san_player by doxygen1.2.16