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/*
2bParse
3Copyright (c) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. 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
25using namespace bParse;
26
27// ----------------------------------------------------- //
28 short ChunkUtils::swapShort(short sht)
29{
30 SWITCH_SHORT(sht);
31 return sht;
32}
33
34// ----------------------------------------------------- //
35 int ChunkUtils::swapInt(int inte)
36{
37 SWITCH_INT(inte);
38 return inte;
39}
40
41// ----------------------------------------------------- //
42 long64 ChunkUtils::swapLong64(long64 lng)
43{
44 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
bChunk.h
long64
#define long64
Definition bChunk.h:20
bDefines.h
SWITCH_SHORT
#define SWITCH_SHORT(a)
Definition bDefines.h:124
SWITCH_LONGINT
#define SWITCH_LONGINT(a)
Definition bDefines.h:134
SWITCH_INT
#define SWITCH_INT(a)
Definition bDefines.h:111
bFile.h
bParse::ChunkUtils::getOffset
static int getOffset(int flags)
Definition bChunk.cpp:49
bParse::ChunkUtils::swapShort
static short swapShort(short sht)
Definition bChunk.cpp:28
bParse::ChunkUtils::swapInt
static int swapInt(int inte)
Definition bChunk.cpp:35
bParse::ChunkUtils::swapLong64
static long64 swapLong64(long64 lng)
Definition bChunk.cpp:42
bParse::bChunkPtr4
Definition bChunk.h:32
bParse::bChunkPtr8
Definition bChunk.h:46
bParse
Definition btBulletWorldImporter.h:24
bParse::VOID_IS_8
const bool VOID_IS_8
Definition bChunk.h:81
bParse::FD_BITS_VARIES
@ FD_BITS_VARIES
Definition bFile.h:33
bParse::CHUNK_HEADER_LEN
const int CHUNK_HEADER_LEN
Definition bChunk.h:80