From 519b14845148bba682b0b51d68d5068d73889938 Mon Sep 17 00:00:00 2001 From: Kromster80 Date: Mon, 10 Nov 2014 15:06:43 +0300 Subject: [PATCH 1/4] Update RecastContour.cpp --- Recast/Source/RecastContour.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Recast/Source/RecastContour.cpp b/Recast/Source/RecastContour.cpp index 8aa9d1d..a7be669 100644 --- a/Recast/Source/RecastContour.cpp +++ b/Recast/Source/RecastContour.cpp @@ -464,7 +464,7 @@ static int calcAreaOfPolygon2D(const int* verts, const int nverts) } // TODO: these are the same as in RecastMesh.cpp, consider using the same. - +// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv). inline int prev(int i, int n) { return i-1 >= 0 ? i-1 : n-1; } inline int next(int i, int n) { return i+1 < n ? i+1 : 0; } From f9ddd3149343c196a636788597f3a28d9a479904 Mon Sep 17 00:00:00 2001 From: Kromster80 Date: Mon, 10 Nov 2014 15:07:17 +0300 Subject: [PATCH 2/4] Update RecastMesh.cpp --- Recast/Source/RecastMesh.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Recast/Source/RecastMesh.cpp b/Recast/Source/RecastMesh.cpp index e4f9c4b..38b45fe 100644 --- a/Recast/Source/RecastMesh.cpp +++ b/Recast/Source/RecastMesh.cpp @@ -160,6 +160,7 @@ static unsigned short addVertex(unsigned short x, unsigned short y, unsigned sho return (unsigned short)i; } +// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv). inline int prev(int i, int n) { return i-1 >= 0 ? i-1 : n-1; } inline int next(int i, int n) { return i+1 < n ? i+1 : 0; } From d9652b362e46a1d20b2fa3c1e23d626d6feb4f41 Mon Sep 17 00:00:00 2001 From: Kromster80 Date: Mon, 10 Nov 2014 15:08:03 +0300 Subject: [PATCH 3/4] Update RecastMeshDetail.cpp --- Recast/Source/RecastMeshDetail.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Recast/Source/RecastMeshDetail.cpp b/Recast/Source/RecastMeshDetail.cpp index 5cc2adf..2fe070b 100644 --- a/Recast/Source/RecastMeshDetail.cpp +++ b/Recast/Source/RecastMeshDetail.cpp @@ -507,15 +507,9 @@ static float polyMinExtent(const float* verts, const int nverts) return rcSqrt(minDist); } -inline int next(int i, int n) -{ - return (i+1) % n; -} - -inline int prev(int i, int n) -{ - return (i + n-1) % n; -} +// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv). +inline int prev(int i, int n) { return i-1 >= 0 ? i-1 : n-1; } +inline int next(int i, int n) { return i+1 < n ? i+1 : 0; } static void triangulateHull(const int nverts, const float* verts, const int nhull, const int* hull, rcIntArray& tris) { From 1381ab113e10a1da9fe7aacfaba2eb6ebbeedfef Mon Sep 17 00:00:00 2001 From: Kromster80 Date: Mon, 10 Nov 2014 15:08:53 +0300 Subject: [PATCH 4/4] Update DetourTileCacheBuilder.cpp --- DetourTileCache/Source/DetourTileCacheBuilder.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/DetourTileCache/Source/DetourTileCacheBuilder.cpp b/DetourTileCache/Source/DetourTileCacheBuilder.cpp index d6602b7..2c82cf0 100644 --- a/DetourTileCache/Source/DetourTileCacheBuilder.cpp +++ b/DetourTileCache/Source/DetourTileCacheBuilder.cpp @@ -1068,6 +1068,7 @@ static bool buildMeshAdjacency(dtTileCacheAlloc* alloc, } +// Last time I checked the if version got compiled using cmov, which was a lot faster than module (with idiv). inline int prev(int i, int n) { return i-1 >= 0 ? i-1 : n-1; } inline int next(int i, int n) { return i+1 < n ? i+1 : 0; }