PageRenderTime 224ms CodeModel.GetById 11ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #include <cfloat>
  29. #include <climits>
  30. typedef signed char S8;
  31. typedef unsigned char U8;
  32. typedef signed short S16;
  33. typedef unsigned short U16;
  34. typedef signed int S32;
  35. typedef unsigned int U32;
  36. #if LL_WINDOWS
  37. // Windows wchar_t is 16-bit
  38. typedef U32 llwchar;
  39. #else
  40. typedef wchar_t llwchar;
  41. #endif
  42. #if LL_WINDOWS
  43. typedef signed __int64 S64;
  44. // probably should be 'hyper' or similiar
  45. #define S64L(a) (a)
  46. typedef unsigned __int64 U64;
  47. #define U64L(a) (a)
  48. #else
  49. typedef long long int S64;
  50. typedef long long unsigned int U64;
  51. #if LL_DARWIN || LL_LINUX || LL_SOLARIS
  52. #define S64L(a) (a##LL)
  53. #define U64L(a) (a##ULL)
  54. #endif
  55. #endif
  56. typedef float F32;
  57. typedef double F64;
  58. typedef S32 BOOL;
  59. typedef U8 KEY;
  60. typedef U32 MASK;
  61. typedef U32 TPACKETID;
  62. // Use #define instead of consts to avoid conversion headaches
  63. #define S8_MAX (SCHAR_MAX)
  64. #define U8_MAX (UCHAR_MAX)
  65. #define S16_MAX (SHRT_MAX)
  66. #define U16_MAX (USHRT_MAX)
  67. #define S32_MAX (INT_MAX)
  68. #define U32_MAX (UINT_MAX)
  69. #define F32_MAX (FLT_MAX)
  70. #define F64_MAX (DBL_MAX)
  71. #define S8_MIN (SCHAR_MIN)
  72. #define U8_MIN (0)
  73. #define S16_MIN (SHRT_MIN)
  74. #define U16_MIN (0)
  75. #define S32_MIN (INT_MIN)
  76. #define U32_MIN (0)
  77. #define F32_MIN (FLT_MIN)
  78. #define F64_MIN (DBL_MIN)
  79. #ifndef TRUE
  80. #define TRUE (1)
  81. #endif
  82. #ifndef FALSE
  83. #define FALSE (0)
  84. #endif
  85. #ifndef NULL
  86. #define NULL (0)
  87. #endif
  88. typedef U8 LLPCode;
  89. #define LL_ARRAY_SIZE( _kArray ) ( sizeof( (_kArray) ) / sizeof( _kArray[0] ) )
  90. #if LL_LINUX && __GNUC__ <= 2
  91. typedef int intptr_t;
  92. #endif
  93. #endif