[wpdev-commits] wolfpack platform.h,1.17,1.18
Brought to you by:
rip,
thiagocorrea
From: Correa <thi...@us...> - 2004-10-14 16:55:45
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5466 Modified Files: platform.h Log Message: Better platform.h :) Index: platform.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/platform.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** platform.h 20 Sep 2004 04:32:14 -0000 1.17 --- platform.h 14 Oct 2004 16:55:34 -0000 1.18 *************** *** 1,98 **** ! //======================================================================== ! //File: platform.h ! //======================================================================== ! // Copyright (c) 2001 by Sheppard Norfleet and Charles Kerr ! // All Rights Reserved ! // ! // Redistribution and use in source and binary forms, with or without ! // modification, are permitted provided the following conditions are met: ! // ! // Redistributions of source code must retain the above copyright notice, ! // this list of conditions and the following disclaimer. Redistributions ! // in binary form must reproduce the above copyright notice, this list of ! // conditions and the following disclaimer in the documentation and/or ! // other materials provided with the distribution. ! // ! // Neither the name of the SWORDS nor the names of its contributors may ! // be used to endorse or promote products derived from this software ! // without specific prior written permission. ! // ! // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ! // `AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ! // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ! // A PARTICULAR PURPOSE ARE DISCLAIMED. . ! //======================================================================== ! #ifndef IN_PLATFORM_H ! #define IN_PLATFORM_H ! //======================================================================== ! enum enByteOrder ! { ! littleEndian, ! bigEndian ! }; ! #define BYTEORDER littleEndian ! // We have to worry about Intel's compilier as well ! ! #if defined(_MSC_VER) | defined(__INTEL_COMPILER) | defined(__BORLANDC__) ! ! //PRAGMAS ! ! //#pragma pack(1) ! #pragma pack(8) ! // no global pack for windows ! ! // packing is activated on per struct basis ! // #include start_pack ! // struct bla ! // { ! // ... ! // } PACK ! // #include stop_pack ! // ! // if we want global packing for windows ! // (for linux its not possible due to bus errors you'll get then) ! // you'd have to de-activate global packing BEFORE including any(!) stl headers ! #pragma warning(disable: 4514) ! #pragma warning(disable: 4786) ! #pragma warning(disable: 4710) ! #pragma warning(disable: 4702) ! // The intel compilier doesnt like this one ! #pragma warning(disable: 985) ! //#pragma optimize("y", off) ! #define OBSOLETETIME ! #define PACK #endif - //======================================================================== - /// GCC - #if defined(__GNUG__) ! #if defined(WIN32) // mingw needs these ! #define OBSOLETETIME #endif ! #define PACK __attribute__((packed)) ! #if __GNUC__ > 2 && !defined(WIN32) ! #undef OBSOLETESTREAM ! #else ! #if __GNUC_MINOR__ < 95 ! #define in_addr_t UI32 ! #endif ! #define OLDGCC ! #define stringstream strstream ! #define sstream strstream ! #define OBSOLETESTREAM ! #endif #endif ! #ifdef Q_OS_FREEBSD ! #include <math.h> ! inline float ceilf(float _X) ! {return ((float)ceil((double)_X)); } #endif - //======================================================================== typedef unsigned long UI32; typedef unsigned short UI16; --- 1,89 ---- ! /* ! * Wolfpack Emu (WP) ! * UO Server Emulation Program ! * ! * Copyright 2001-2004 by holders identified in AUTHORS.txt ! * This program is free software; you can redistribute it and/or modify ! * it under the terms of the GNU General Public License as published by ! * the Free Software Foundation; either version 2 of the License, or ! * (at your option) any later version. ! * ! * 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 General Public License for more details. ! * ! * You should have received a copy of the GNU General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Palace - Suite 330, Boston, MA 02111-1307, USA. ! * ! * In addition to that license, if you are running this program or modified ! * versions of it on a public system you HAVE TO make the complete source of ! * the version used by you available or provide people with a location to ! * download it. ! * ! * Wolfpack Homepage: http://wpdev.sf.net/ ! */ ! #if !defined( __PLATFORM_H__ ) ! #define __PLATFORM_H__ ! #include <qglobal.h> ! #if defined(Q_CC_MSVC) | defined(Q_CC_INTEL) | defined(Q_CC_BOR) ! # pragma pack(8) ! # pragma warning(disable: 4514) ! # pragma warning(disable: 4786) ! # pragma warning(disable: 4710) ! # pragma warning(disable: 4702) + // The intel compiler doesn't like this one + # pragma warning(disable: 985) + # define PACK #endif ! #if defined(Q_CC_GNU) ! # define PACK __attribute__((packed)) #endif ! #if defined (Q_OS_FREEBSD) ! # include <math.h> ! inline float ceilf(float _X) ! {return ((float)ceil((double)_X)); } #endif ! /*! ! * The WP_ISLIKELY macro tags a boolean expression as likely to evaluate to ! * 'true'. When used in an if ( ) statement, it gives a hint to the compiler ! * that the following code block is likely to get executed. Providing this ! * information helps the compiler to optimize the code for better performance. ! * Using the macro has an insignificant code size or runtime memory footprint impact. ! * The code semantics is not affected. ! * ! * \note ! * Providing wrong information ( like marking a condition that almost never ! * passes as 'likely' ) will cause a significant runtime slowdown. Therefore only ! * use it for cases where you can be sure about the odds of the expression to pass ! * in all cases ( independent from e.g. user configuration ). ! * ! * \par ! * The WP_ISUNLIKELY macro tags an expression as unlikely evaluating to 'true'. ! * ! * \note ! * Do NOT use ( !WP_ISLIKELY(foo) ) as an replacement for WP_ISUNLIKELY ! ! * ! * \code ! * if ( WP_ISUNLIKELY( testsomething() ) ) ! * abort(); // assume its unlikely that the application aborts ! * \endcode ! */ ! #if __GNUC__ - 0 >= 3 ! # define WP_ISLIKELY( x ) __builtin_expect(!!(x),1) ! # define WP_ISUNLIKELY( x ) __builtin_expect(!!(x),0) ! #else ! # define WP_ISLIKELY( x ) ( x ) ! # define WP_ISUNLIKELY( x ) ( x ) #endif typedef unsigned long UI32; typedef unsigned short UI16; *************** *** 103,112 **** typedef float RF32; typedef double RF64; - //======================================================================== - //======================================================================== - //======================================================================== - //====================== End of platform.h ============================= - //======================================================================== - //======================================================================== ! #endif --- 94,97 ---- typedef float RF32; typedef double RF64; ! #endif // __PLATFORM_H__ |