# HG changeset patch # User koda # Date 1255278239 0 # Node ID f7ed1ea250507012badd24ce35fd80b45a031f79 # Parent 3278cf087339613c4ac3961a057d0dd8573aa750 updated build method diff -r 3278cf087339 -r f7ed1ea25050 openalbridge/CMakeLists.txt --- a/openalbridge/CMakeLists.txt Sun Oct 11 16:19:32 2009 +0000 +++ b/openalbridge/CMakeLists.txt Sun Oct 11 16:23:59 2009 +0000 @@ -8,7 +8,7 @@ #list of source files for libraries set(openal_src - openalbridge.c loaders.c endianness.c wrappers.c + openalbridge.c loaders.c wrappers.c ) #build a static library for human systems @@ -18,7 +18,7 @@ if(WIN32) #workaround for visualstudio (wants headers in the source list) set(openal_src - openalbridge.h loaders.h endianness.h wrappers.h globals.h oggvorbis.h ${openal_src} + openalbridge.h loaders.h wrappers.h globals.h oggvorbis.h ${openal_src} ) #deps for the shared library link_libraries(${VORBISFILE_LIBRARY}) diff -r 3278cf087339 -r f7ed1ea25050 openalbridge/endianness.c --- a/openalbridge/endianness.c Sun Oct 11 16:19:32 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "endianness.h" - -#ifdef __CPLUSPLUS -extern "C" { -#endif - - - -#ifdef __CPLUSPLUS -} -#endif diff -r 3278cf087339 -r f7ed1ea25050 openalbridge/endianness.h --- a/openalbridge/endianness.h Sun Oct 11 16:19:32 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * OpenAL Bridge - a simple portable library for OpenAL interface - * Copyright (c) 2009 Vittorio Giovara - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _OALB_ENDIANNESS_H -#define _OALB_ENDIANNESS_H - -#include "globals.h" - - -#ifdef __CPLUSPLUS -extern "C" { -#endif - - -/* check compiler requirements */ -#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) -#error Do not know the endianess of this architecture -#endif - - -/* use byteswap macros from the host system, hopefully optimized ones ;-) - * or define our own version, simple, stupid, straight-forward... */ -#ifdef HAVE_BYTESWAP_H -#include -#else -#define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) -#define bswap_32(x) ((((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \ -(((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) ) -#endif /* HAVE_BYTESWAP_H */ - - -/* swap numbers accordingly to architecture automatically */ -#ifdef __LITTLE_ENDIAN__ -#define ENDIAN_LITTLE_32(x) x -#define ENDIAN_BIG_32(x) bswap_32(x) -#define ENDIAN_LITTLE_16(x) x -#define ENDIAN_BIG_16(x) bswap_16(x) -#elif __BIG_ENDIAN__ -#define ENDIAN_LITTLE_32(x) bswap_32(x) -#define ENDIAN_BIG_32(x) x -#define ENDIAN_LITTLE_16(x) bswap_16(x) -#define ENDIAN_BIG_16(x) x -#endif - - -#ifdef __CPLUSPLUS -} -#endif - -#endif /*_OALB_ENDIANNESS_H*/ diff -r 3278cf087339 -r f7ed1ea25050 openalbridge/globals.h --- a/openalbridge/globals.h Sun Oct 11 16:19:32 2009 +0000 +++ b/openalbridge/globals.h Sun Oct 11 16:23:59 2009 +0000 @@ -58,9 +58,33 @@ #endif /* _SLEEP_H */ - +/* check compiler requirements */ +#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +#error Do not know the endianess of this architecture +#endif +/* use byteswap macros from the host system, hopefully optimized ones ;-) + * or define our own version, simple, stupid, straight-forward... */ +#ifdef HAVE_BYTESWAP_H +#include +#else +#define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) +#define bswap_32(x) ((((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \ +(((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) ) +#endif /* HAVE_BYTESWAP_H */ +/* swap numbers accordingly to architecture automatically */ +#ifdef __LITTLE_ENDIAN__ +#define ENDIAN_LITTLE_32(x) x +#define ENDIAN_BIG_32(x) bswap_32(x) +#define ENDIAN_LITTLE_16(x) x +#define ENDIAN_BIG_16(x) bswap_16(x) +#elif __BIG_ENDIAN__ +#define ENDIAN_LITTLE_32(x) bswap_32(x) +#define ENDIAN_BIG_32(x) x +#define ENDIAN_LITTLE_16(x) bswap_16(x) +#define ENDIAN_BIG_16(x) x +#endif #ifdef __CPLUSPLUS