PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcommon/stdtypes.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 109 lines | 65 code | 16 blank | 28 comment | 3 complexity | fa8ed05c679053f929d4ef82ba5d9987 MD5 | raw file
  1/** 
  2 * @file stdtypes.h
  3 * @brief Basic type declarations for cross platform compatibility.
  4 *
  5 * $LicenseInfo:firstyear=2000&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26#ifndef LL_STDTYPES_H
 27#define LL_STDTYPES_H
 28
 29#include <cfloat>
 30#include <climits>
 31
 32typedef signed char			S8;
 33typedef unsigned char			U8;
 34typedef signed short			S16;
 35typedef unsigned short			U16;
 36typedef signed int			S32;
 37typedef unsigned int			U32;
 38
 39#if LL_WINDOWS
 40// Windows wchar_t is 16-bit
 41typedef U32				llwchar;
 42#else
 43typedef wchar_t				llwchar;
 44#endif
 45
 46#if LL_WINDOWS
 47typedef signed __int64			S64;
 48// probably should be 'hyper' or similiar
 49#define S64L(a)					(a)
 50typedef unsigned __int64		U64;
 51#define U64L(a)					(a)
 52#else
 53typedef long long int			S64;
 54typedef long long unsigned int		U64;
 55#if LL_DARWIN || LL_LINUX || LL_SOLARIS
 56#define S64L(a)				(a##LL)
 57#define U64L(a)				(a##ULL)
 58#endif
 59#endif
 60
 61typedef float				F32;
 62typedef double				F64;
 63
 64typedef S32				BOOL;
 65typedef U8				KEY;
 66typedef U32				MASK;
 67typedef U32             		TPACKETID;
 68
 69// Use #define instead of consts to avoid conversion headaches
 70#define S8_MAX		(SCHAR_MAX)
 71#define U8_MAX		(UCHAR_MAX)
 72#define S16_MAX		(SHRT_MAX)
 73#define U16_MAX		(USHRT_MAX)
 74#define S32_MAX		(INT_MAX)
 75#define U32_MAX		(UINT_MAX)
 76#define F32_MAX		(FLT_MAX)
 77#define F64_MAX		(DBL_MAX)
 78
 79#define S8_MIN		(SCHAR_MIN)
 80#define U8_MIN		(0)
 81#define S16_MIN		(SHRT_MIN)
 82#define U16_MIN		(0)
 83#define S32_MIN		(INT_MIN)
 84#define U32_MIN		(0)
 85#define F32_MIN		(FLT_MIN)
 86#define F64_MIN		(DBL_MIN)
 87
 88
 89#ifndef TRUE
 90#define TRUE			(1)
 91#endif
 92
 93#ifndef FALSE
 94#define FALSE			(0)
 95#endif
 96
 97#ifndef NULL
 98#define NULL			(0)
 99#endif
100
101typedef U8 LLPCode;
102
103#define	LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) )
104
105#if LL_LINUX && __GNUC__ <= 2
106typedef int intptr_t;
107#endif
108
109#endif