TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ObjectDefines.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITY_OBJECTDEFINES_H
20 #define TRINITY_OBJECTDEFINES_H
21 
22 #include "Define.h"
23 #include "ObjectGuid.h"
24 
25 // used for creating values for respawn for example
26 inline uint64 MAKE_PAIR64(uint32 l, uint32 h);
29 inline uint16 MAKE_PAIR16(uint8 l, uint8 h);
30 inline uint32 MAKE_PAIR32(uint16 l, uint16 h);
33 
35 {
36  return uint64(l | (uint64(h) << 32));
37 }
38 
40 {
41  return (uint32)((x >> 32) & UI64LIT(0x00000000FFFFFFFF));
42 }
43 
45 {
46  return (uint32)(x & UI64LIT(0x00000000FFFFFFFF));
47 }
48 
50 {
51  return uint16(l | (uint16(h) << 8));
52 }
53 
55 {
56  return uint32(l | (uint32(h) << 16));
57 }
58 
60 {
61  return (uint16)((x >> 16) & 0x0000FFFF);
62 }
63 
65 {
66  return (uint16)(x & 0x0000FFFF);
67 }
68 
69 #endif
uint16 MAKE_PAIR16(uint8 l, uint8 h)
Definition: ObjectDefines.h:49
#define UI64LIT(N)
Definition: Define.h:138
uint64_t uint64
Definition: g3dmath.h:170
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:34
uint16_t uint16
Definition: g3dmath.h:166
uint32 PAIR64_LOPART(uint64 x)
Definition: ObjectDefines.h:44
uint16 PAIR32_LOPART(uint32 x)
Definition: ObjectDefines.h:64
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
uint16_t uint16
Definition: Define.h:151
uint32 PAIR64_HIPART(uint64 x)
Definition: ObjectDefines.h:39
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
uint16 PAIR32_HIPART(uint32 x)
Definition: ObjectDefines.h:59
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:54