[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / Bullet3Serialize / Bullet2FileLoader / b3Chunk.h
1 /*
2 bParse
3 Copyright (c) 2006-2009 Charlie C & Erwin Coumans  http://gamekit.googlecode.com
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
16 #ifndef __BCHUNK_H__
17 #define __BCHUNK_H__
18
19 #if defined(_WIN32) && !defined(__MINGW32__)
20 #define b3Long64 __int64
21 #elif defined(__MINGW32__)
22 #include <stdint.h>
23 #define b3Long64 int64_t
24 #else
25 #define b3Long64 long long
26 #endif
27
28 namespace bParse
29 {
30 // ----------------------------------------------------- //
31 class bChunkPtr4
32 {
33 public:
34         bChunkPtr4() {}
35         int code;
36         int len;
37         union {
38                 int m_uniqueInt;
39         };
40         int dna_nr;
41         int nr;
42 };
43
44 // ----------------------------------------------------- //
45 class bChunkPtr8
46 {
47 public:
48         bChunkPtr8() {}
49         int code, len;
50         union {
51                 b3Long64 oldPrev;
52                 int m_uniqueInts[2];
53         };
54         int dna_nr, nr;
55 };
56
57 // ----------------------------------------------------- //
58 class bChunkInd
59 {
60 public:
61         bChunkInd() {}
62         int code, len;
63         void *oldPtr;
64         int dna_nr, nr;
65 };
66
67 // ----------------------------------------------------- //
68 class ChunkUtils
69 {
70 public:
71         // file chunk offset
72         static int getOffset(int flags);
73
74         // endian utils
75         static short swapShort(short sht);
76         static int swapInt(int inte);
77         static b3Long64 swapLong64(b3Long64 lng);
78 };
79
80 const int CHUNK_HEADER_LEN = ((sizeof(bChunkInd)));
81 const bool VOID_IS_8 = ((sizeof(void *) == 8));
82 }  // namespace bParse
83
84 #endif  //__BCHUNK_H__