Bullet Collision Detection & Physics Library: bChunk.cpp Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

bChunk.cpp
Go to the documentation of this file.
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 "bChunk.h"
17 #include "bDefines.h"
18 #include "bFile.h"
19
20 #if !defined( __CELLOS_LV2__) && !defined(__MWERKS__)
21 #include <memory.h>
22 #endif
23 #include <string.h>
24
25
26 using namespace bParse;
27
28
29 // ----------------------------------------------------- //
30 short ChunkUtils::swapShort(short sht)
31 {
32 SWITCH_SHORT(sht);
33 return sht;
34 }
35
36 // ----------------------------------------------------- //
37 int ChunkUtils::swapInt(int inte)
38 {
39 SWITCH_INT(inte);
40 return inte;
41 }
42
43 // ----------------------------------------------------- //
44 long64 ChunkUtils::swapLong64(long64 lng)
45 {
46 SWITCH_LONGINT(lng);
47 return lng;
48 }
49
50 // ----------------------------------------------------- //
51 int ChunkUtils::getOffset(int flags)
52 {
53 // if the file is saved in a
54 // different format, get the
55 // file's chunk size
56 int res = CHUNK_HEADER_LEN;
57
58 if (VOID_IS_8)
59 {
60 if (flags &FD_BITS_VARIES)
61 res = sizeof(bChunkPtr4);
62 }
63 else
64 {
65 if (flags &FD_BITS_VARIES)
66 res = sizeof(bChunkPtr8);
67 }
68 return res;
69 }
70
71
72
73
74
75 //eof
bFile.h
bParse::bChunkPtr4
Definition: bChunk.h:33
bParse::ChunkUtils::swapLong64
static long64 swapLong64(long64 lng)
Definition: bChunk.cpp:44
bParse::ChunkUtils::swapInt
static int swapInt(int inte)
Definition: bChunk.cpp:37
SWITCH_LONGINT
#define SWITCH_LONGINT(a)
Definition: bDefines.h:131
bParse::bChunkPtr8
Definition: bChunk.h:48
bParse::VOID_IS_8
const bool VOID_IS_8
Definition: bChunk.h:89
SWITCH_INT
#define SWITCH_INT(a)
Definition: bDefines.h:118
bChunk.h
bParse::CHUNK_HEADER_LEN
const int CHUNK_HEADER_LEN
Definition: bChunk.h:88
bParse
Definition: btBulletWorldImporter.h:29
bDefines.h
bParse::FD_BITS_VARIES
Definition: bFile.h:33
bParse::ChunkUtils::swapShort
static short swapShort(short sht)
Definition: bChunk.cpp:30
SWITCH_SHORT
#define SWITCH_SHORT(a)
Definition: bDefines.h:125
long64
#define long64
Definition: bChunk.h:20
bParse::ChunkUtils::getOffset
static int getOffset(int flags)
Definition: bChunk.cpp:51