[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / Bullet3Serialize / Bullet2FileLoader / b3Chunk.cpp
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 #include "b3Chunk.h"
17 #include "b3Defines.h"
18 #include "b3File.h"
19
20 #if !defined(__CELLOS_LV2__) && !defined(__MWERKS__)
21 #include <memory.h>
22 #endif
23 #include <string.h>
24
25 using namespace bParse;
26
27 // ----------------------------------------------------- //
28 short ChunkUtils::swapShort(short sht)
29 {
30         B3_SWITCH_SHORT(sht);
31         return sht;
32 }
33
34 // ----------------------------------------------------- //
35 int ChunkUtils::swapInt(int inte)
36 {
37         B3_SWITCH_INT(inte);
38         return inte;
39 }
40
41 // ----------------------------------------------------- //
42 b3Long64 ChunkUtils::swapLong64(b3Long64 lng)
43 {
44         B3_SWITCH_LONGINT(lng);
45         return lng;
46 }
47
48 // ----------------------------------------------------- //
49 int ChunkUtils::getOffset(int flags)
50 {
51         // if the file is saved in a
52         // different format, get the
53         // file's chunk size
54         int res = CHUNK_HEADER_LEN;
55
56         if (VOID_IS_8)
57         {
58                 if (flags & FD_BITS_VARIES)
59                         res = sizeof(bChunkPtr4);
60         }
61         else
62         {
63                 if (flags & FD_BITS_VARIES)
64                         res = sizeof(bChunkPtr8);
65         }
66         return res;
67 }
68
69 //eof