Some cast fixes for 64bit ref support.

This commit is contained in:
Mikko Mononen 2010-10-15 13:04:05 +00:00
parent 43a79f600f
commit b13a0e60c8
4 changed files with 75 additions and 19 deletions

View File

@ -301,33 +301,33 @@ public:
// Encodes a tile id. // Encodes a tile id.
inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
{ {
return (salt << (m_polyBits+m_tileBits)) | (it << m_polyBits) | ip; return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
} }
// Decodes a tile id. // Decodes a tile id.
inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
{ {
salt = (ref >> (m_polyBits+m_tileBits)) & ((1<<m_saltBits)-1); salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & ((1<<m_saltBits)-1));
it = (ref >> m_polyBits) & ((1<<m_tileBits)-1); it = (unsigned int)((ref >> m_polyBits) & ((1<<m_tileBits)-1));
ip = ref & ((1<<m_polyBits)-1); ip = (unsigned int)(ref & ((1<<m_polyBits)-1));
} }
// Decodes a tile salt. // Decodes a tile salt.
inline unsigned int decodePolyIdSalt(dtPolyRef ref) const inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
{ {
return (ref >> (m_polyBits+m_tileBits)) & ((1<<m_saltBits)-1); return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & ((1<<m_saltBits)-1));
} }
// Decodes a tile id. // Decodes a tile id.
inline unsigned int decodePolyIdTile(dtPolyRef ref) const inline unsigned int decodePolyIdTile(dtPolyRef ref) const
{ {
return (ref >> m_polyBits) & ((1<<m_tileBits)-1); return (unsigned int)((ref >> m_polyBits) & ((1<<m_tileBits)-1));
} }
// Decodes a poly id. // Decodes a poly id.
inline unsigned int decodePolyIdPoly(dtPolyRef ref) const inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
{ {
return ref & ((1<<m_polyBits)-1); return (unsigned int)(ref & ((1<<m_polyBits)-1));
} }
private: private:

View File

@ -202,6 +202,11 @@
6B1635D4126887C80083FC15 /* PBXTextBookmark */ = 6B1635D4126887C80083FC15 /* PBXTextBookmark */; 6B1635D4126887C80083FC15 /* PBXTextBookmark */ = 6B1635D4126887C80083FC15 /* PBXTextBookmark */;
6B1635D5126887C80083FC15 /* XCBuildMessageTextBookmark */ = 6B1635D5126887C80083FC15 /* XCBuildMessageTextBookmark */; 6B1635D5126887C80083FC15 /* XCBuildMessageTextBookmark */ = 6B1635D5126887C80083FC15 /* XCBuildMessageTextBookmark */;
6B1635D6126887C80083FC15 /* PBXTextBookmark */ = 6B1635D6126887C80083FC15 /* PBXTextBookmark */; 6B1635D6126887C80083FC15 /* PBXTextBookmark */ = 6B1635D6126887C80083FC15 /* PBXTextBookmark */;
6B1635D91268881A0083FC15 /* PBXTextBookmark */ = 6B1635D91268881A0083FC15 /* PBXTextBookmark */;
6B1635DA1268881A0083FC15 /* PBXTextBookmark */ = 6B1635DA1268881A0083FC15 /* PBXTextBookmark */;
6B1635DB1268881A0083FC15 /* PBXTextBookmark */ = 6B1635DB1268881A0083FC15 /* PBXTextBookmark */;
6B1635DC1268882D0083FC15 /* PBXTextBookmark */ = 6B1635DC1268882D0083FC15 /* PBXTextBookmark */;
6B1635DF1268887E0083FC15 /* PBXTextBookmark */ = 6B1635DF1268887E0083FC15 /* PBXTextBookmark */;
6B1C8E08121EB4FF0048697F = 6B1C8E08121EB4FF0048697F /* PBXTextBookmark */; 6B1C8E08121EB4FF0048697F = 6B1C8E08121EB4FF0048697F /* PBXTextBookmark */;
6B4214D911803923006C347B = 6B4214D911803923006C347B /* PBXTextBookmark */; 6B4214D911803923006C347B = 6B4214D911803923006C347B /* PBXTextBookmark */;
6B847515122B9F4900ADF63D = 6B847515122B9F4900ADF63D /* PBXTextBookmark */; 6B847515122B9F4900ADF63D = 6B847515122B9F4900ADF63D /* PBXTextBookmark */;
@ -1150,6 +1155,56 @@
vrLen = 811; vrLen = 811;
vrLoc = 11296; vrLoc = 11296;
}; };
6B1635D91268881A0083FC15 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */;
name = "main.cpp: 484";
rLen = 0;
rLoc = 11740;
rType = 0;
vrLen = 811;
vrLoc = 11296;
};
6B1635DA1268881A0083FC15 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */;
name = "DetourNavMesh.h: 39";
rLen = 0;
rLoc = 1578;
rType = 0;
vrLen = 1248;
vrLoc = 1088;
};
6B1635DB1268881A0083FC15 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */;
name = "DetourNavMesh.h: 302";
rLen = 199;
rLoc = 11997;
rType = 0;
vrLen = 1357;
vrLoc = 11137;
};
6B1635DC1268882D0083FC15 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */;
name = "DetourNavMesh.h: 304";
rLen = 0;
rLoc = 12188;
rType = 0;
vrLen = 1368;
vrLoc = 11137;
};
6B1635DF1268887E0083FC15 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */;
name = "DetourNavMesh.h: 318";
rLen = 0;
rLoc = 12637;
rType = 0;
vrLen = 1288;
vrLoc = 11723;
};
6B1C8E08121EB4FF0048697F /* PBXTextBookmark */ = { 6B1C8E08121EB4FF0048697F /* PBXTextBookmark */ = {
isa = PBXTextBookmark; isa = PBXTextBookmark;
fRef = 6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */; fRef = 6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */;
@ -1177,7 +1232,7 @@
6B25B6180FFA62BE004F1BC4 /* main.cpp */ = { 6B25B6180FFA62BE004F1BC4 /* main.cpp */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 11934}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 11934}}";
sepNavSelRange = "{11714, 0}"; sepNavSelRange = "{11740, 0}";
sepNavVisRange = "{11296, 811}"; sepNavVisRange = "{11296, 811}";
sepNavWindowFrame = "{{15, 51}, {1214, 722}}"; sepNavWindowFrame = "{{15, 51}, {1214, 722}}";
}; };
@ -1466,9 +1521,9 @@
}; };
6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */ = { 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */ = {
uiCtxt = { uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {931, 5200}}"; sepNavIntBoundsRect = "{{0, 0}, {931, 5278}}";
sepNavSelRange = "{1578, 0}"; sepNavSelRange = "{12637, 0}";
sepNavVisRange = "{1163, 1171}"; sepNavVisRange = "{11723, 1288}";
}; };
}; };
6B8DE88C10B69E4C00DF20FB /* DetourNavMeshBuilder.h */ = { 6B8DE88C10B69E4C00DF20FB /* DetourNavMeshBuilder.h */ = {
@ -1483,7 +1538,7 @@
fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */; fRef = 6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */;
name = detail; name = detail;
rLen = 0; rLen = 0;
rLoc = 12767; rLoc = 12880;
rType = 0; rType = 0;
vrLen = 1182; vrLen = 1182;
vrLoc = 9676; vrLoc = 9676;

View File

@ -284,13 +284,14 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array> <array>
<array> <array>
<integer>81</integer> <integer>15</integer>
<integer>11</integer>
<integer>1</integer> <integer>1</integer>
<integer>0</integer> <integer>0</integer>
</array> </array>
</array> </array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 692}, {264, 660}}</string> <string>{{0, 0}, {264, 660}}</string>
</dict> </dict>
<key>PBXTopSmartGroupGIDs</key> <key>PBXTopSmartGroupGIDs</key>
<array/> <array/>
@ -325,7 +326,7 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>6B8632A30F78115100E2684A</string> <string>6B8632A30F78115100E2684A</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>main.cpp</string> <string>DetourNavMesh.h</string>
<key>PBXSplitModuleInNavigatorKey</key> <key>PBXSplitModuleInNavigatorKey</key>
<dict> <dict>
<key>Split0</key> <key>Split0</key>
@ -333,11 +334,11 @@
<key>PBXProjectModuleGUID</key> <key>PBXProjectModuleGUID</key>
<string>6B8632A40F78115100E2684A</string> <string>6B8632A40F78115100E2684A</string>
<key>PBXProjectModuleLabel</key> <key>PBXProjectModuleLabel</key>
<string>main.cpp</string> <string>DetourNavMesh.h</string>
<key>_historyCapacity</key> <key>_historyCapacity</key>
<integer>0</integer> <integer>0</integer>
<key>bookmark</key> <key>bookmark</key>
<string>6B1635D6126887C80083FC15</string> <string>6B1635DF1268887E0083FC15</string>
<key>history</key> <key>history</key>
<array> <array>
<string>6BBB4C34115B7A3D00CF791D</string> <string>6BBB4C34115B7A3D00CF791D</string>
@ -414,7 +415,6 @@
<string>6B1633121268326F0083FC15</string> <string>6B1633121268326F0083FC15</string>
<string>6B1633141268326F0083FC15</string> <string>6B1633141268326F0083FC15</string>
<string>6B163317126832D20083FC15</string> <string>6B163317126832D20083FC15</string>
<string>6B16338112684C6F0083FC15</string>
<string>6B16357012687A5D0083FC15</string> <string>6B16357012687A5D0083FC15</string>
<string>6B16357112687A5D0083FC15</string> <string>6B16357112687A5D0083FC15</string>
<string>6B16358E12687D740083FC15</string> <string>6B16358E12687D740083FC15</string>
@ -429,7 +429,8 @@
<string>6B1635C9126885AD0083FC15</string> <string>6B1635C9126885AD0083FC15</string>
<string>6B1635D3126887C80083FC15</string> <string>6B1635D3126887C80083FC15</string>
<string>6B1635D4126887C80083FC15</string> <string>6B1635D4126887C80083FC15</string>
<string>6B1635D5126887C80083FC15</string> <string>6B1635D91268881A0083FC15</string>
<string>6B1635DA1268881A0083FC15</string>
</array> </array>
</dict> </dict>
<key>SplitCount</key> <key>SplitCount</key>