Browse Source

Changed: Memory and pointer size integer type use has been changed so that internal typedefs are used instead of "_t" suffixed types

Oleh Derevenko 8 years ago
parent
commit
c193762e69
100 changed files with 575 additions and 566 deletions
  1. 4 0
      CHANGELOG.txt
  2. 1 1
      include/ode/collision_trimesh.h
  3. 6 6
      include/ode/memory.h
  4. 3 3
      include/ode/objects.h
  5. 5 0
      include/ode/odeconfig.h
  6. 3 3
      include/ode/threading.h
  7. 1 1
      include/ode/threading_impl.h
  8. 1 1
      ode/demo/demo_boxstack.cpp
  9. 1 1
      ode/demo/demo_chain2.cpp
  10. 1 1
      ode/demo/demo_heightfield.cpp
  11. 1 1
      ode/demo/demo_motion.cpp
  12. 1 1
      ode/demo/demo_moving_convex.cpp
  13. 1 1
      ode/demo/demo_moving_trimesh.cpp
  14. 13 13
      ode/demo/demo_ode.cpp
  15. 1 1
      ode/demo/demo_plane2d.cpp
  16. 7 7
      ode/demo/demo_space.cpp
  17. 1 1
      ode/demo/demo_trimesh.cpp
  18. 1 1
      ode/src/collision_libccd.cpp
  19. 4 4
      ode/src/collision_quadtreespace.cpp
  20. 16 16
      ode/src/collision_sapspace.cpp
  21. 4 4
      ode/src/collision_space.cpp
  22. 2 2
      ode/src/collision_trimesh_disabled.cpp
  23. 10 10
      ode/src/collision_trimesh_gimpact.cpp
  24. 1 1
      ode/src/collision_trimesh_gimpact.h
  25. 11 11
      ode/src/collision_trimesh_internal.cpp
  26. 2 2
      ode/src/collision_trimesh_internal.h
  27. 5 5
      ode/src/collision_trimesh_internal_impl.h
  28. 11 11
      ode/src/collision_trimesh_opcode.cpp
  29. 5 5
      ode/src/collision_trimesh_opcode.h
  30. 16 16
      ode/src/common.h
  31. 2 2
      ode/src/convex.cpp
  32. 6 6
      ode/src/fastldltfactor.cpp
  33. 6 6
      ode/src/fastldltfactor_impl.h
  34. 2 2
      ode/src/fastlsolve.cpp
  35. 25 25
      ode/src/fastlsolve_impl.h
  36. 2 2
      ode/src/fastltsolve.cpp
  37. 15 15
      ode/src/fastltsolve_impl.h
  38. 1 1
      ode/src/fastvecscale.cpp
  39. 7 7
      ode/src/fastvecscale_impl.h
  40. 19 19
      ode/src/heightfield.cpp
  41. 14 14
      ode/src/heightfield.h
  42. 2 2
      ode/src/joints/amotor.cpp
  43. 1 1
      ode/src/joints/amotor.h
  44. 1 1
      ode/src/joints/ball.cpp
  45. 1 1
      ode/src/joints/ball.h
  46. 1 1
      ode/src/joints/contact.cpp
  47. 1 1
      ode/src/joints/contact.h
  48. 1 1
      ode/src/joints/dball.cpp
  49. 1 1
      ode/src/joints/dball.h
  50. 1 1
      ode/src/joints/dhinge.cpp
  51. 1 1
      ode/src/joints/dhinge.h
  52. 1 1
      ode/src/joints/fixed.cpp
  53. 1 1
      ode/src/joints/fixed.h
  54. 1 1
      ode/src/joints/hinge.cpp
  55. 1 1
      ode/src/joints/hinge.h
  56. 1 1
      ode/src/joints/hinge2.cpp
  57. 1 1
      ode/src/joints/hinge2.h
  58. 2 2
      ode/src/joints/joint.cpp
  59. 5 5
      ode/src/joints/joint.h
  60. 1 1
      ode/src/joints/lmotor.cpp
  61. 1 1
      ode/src/joints/lmotor.h
  62. 1 1
      ode/src/joints/null.cpp
  63. 1 1
      ode/src/joints/null.h
  64. 1 1
      ode/src/joints/piston.cpp
  65. 1 1
      ode/src/joints/piston.h
  66. 1 1
      ode/src/joints/plane2d.cpp
  67. 1 1
      ode/src/joints/plane2d.h
  68. 1 1
      ode/src/joints/pr.cpp
  69. 1 1
      ode/src/joints/pr.h
  70. 1 1
      ode/src/joints/pu.cpp
  71. 1 1
      ode/src/joints/pu.h
  72. 1 1
      ode/src/joints/slider.cpp
  73. 1 1
      ode/src/joints/slider.h
  74. 1 1
      ode/src/joints/transmission.cpp
  75. 1 1
      ode/src/joints/transmission.h
  76. 1 1
      ode/src/joints/universal.cpp
  77. 1 1
      ode/src/joints/universal.h
  78. 36 36
      ode/src/lcp.cpp
  79. 1 1
      ode/src/lcp.h
  80. 19 19
      ode/src/matrix.cpp
  81. 16 16
      ode/src/matrix.h
  82. 3 3
      ode/src/memory.cpp
  83. 4 4
      ode/src/obstack.cpp
  84. 4 4
      ode/src/obstack.h
  85. 8 8
      ode/src/ode.cpp
  86. 1 1
      ode/src/odetls.cpp
  87. 5 5
      ode/src/odetls.h
  88. 63 63
      ode/src/quickstep.cpp
  89. 1 1
      ode/src/quickstep.h
  90. 1 1
      ode/src/resource_control.cpp
  91. 4 4
      ode/src/resource_control.h
  92. 56 56
      ode/src/step.cpp
  93. 1 1
      ode/src/step.h
  94. 21 21
      ode/src/threaded_solver_ldlt.h
  95. 10 10
      ode/src/threading_atomics_provs.h
  96. 4 4
      ode/src/threading_impl_templates.h
  97. 17 17
      ode/src/threading_pool_posix.cpp
  98. 16 16
      ode/src/threading_pool_win.cpp
  99. 2 2
      ode/src/threadingutils.h
  100. 2 2
      ode/src/timer.cpp

+ 4 - 0
CHANGELOG.txt

@@ -8,6 +8,10 @@ the rules for this file:
   * keep the format consistent (79 char width, M/D/Y date format).
 
 ------------------------------------------------------------------------------
+06/06/2017 Oleh Derevenko
+        * Memory and pointer size integer type use has been changed so that 
+          internal typedefs are used instead of "_t" suffixed types.
+
 05/09/2017 Oleh Derevenko
         * Introduction of cooperative algorithms API. 
           L*D*LT cooperative factorization and linear equation system 

+ 1 - 1
include/ode/collision_trimesh.h

@@ -102,7 +102,7 @@ enum
  */
 ODE_API void dGeomTriMeshDataSet(dTriMeshDataID g, int data_id, void *in_data);
 ODE_API void *dGeomTriMeshDataGet(dTriMeshDataID g, int data_id);
-ODE_API void *dGeomTriMeshDataGet2(dTriMeshDataID g, int data_id, size_t *pout_size/*=NULL*/);
+ODE_API void *dGeomTriMeshDataGet2(dTriMeshDataID g, int data_id, dsizeint *pout_size/*=NULL*/);
 
 
 

+ 6 - 6
include/ode/memory.h

@@ -32,9 +32,9 @@ extern "C" {
 #endif
 
 /* function types to allocate and free memory */
-typedef void * dAllocFunction (size_t size);
-typedef void * dReallocFunction (void *ptr, size_t oldsize, size_t newsize);
-typedef void dFreeFunction (void *ptr, size_t size);
+typedef void * dAllocFunction (dsizeint size);
+typedef void * dReallocFunction (void *ptr, dsizeint oldsize, dsizeint newsize);
+typedef void dFreeFunction (void *ptr, dsizeint size);
 
 /* set new memory management functions. if fn is 0, the default handlers are
  * used. */
@@ -48,9 +48,9 @@ ODE_API dReallocFunction *dGetReallocHandler (void);
 ODE_API dFreeFunction *dGetFreeHandler (void);
 
 /* allocate and free memory. */
-ODE_API void * dAlloc (size_t size);
-ODE_API void * dRealloc (void *ptr, size_t oldsize, size_t newsize);
-ODE_API void dFree (void *ptr, size_t size);
+ODE_API void * dAlloc (dsizeint size);
+ODE_API void * dRealloc (void *ptr, dsizeint oldsize, dsizeint newsize);
+ODE_API void dFree (void *ptr, dsizeint size);
 
 #ifdef __cplusplus
 }

+ 3 - 3
include/ode/objects.h

@@ -315,9 +315,9 @@ ODE_API int dWorldSetStepMemoryReservationPolicy(dWorldID w, const dWorldStepRes
 typedef struct 
 {
   unsigned struct_size;
-  void *(*alloc_block)(size_t block_size);
-  void *(*shrink_block)(void *block_pointer, size_t block_current_size, size_t block_smaller_size);
-  void (*free_block)(void *block_pointer, size_t block_current_size);
+  void *(*alloc_block)(dsizeint block_size);
+  void *(*shrink_block)(void *block_pointer, dsizeint block_current_size, dsizeint block_smaller_size);
+  void (*free_block)(void *block_pointer, dsizeint block_current_size);
 
 } dWorldStepMemoryFunctionsInfo;
 

+ 5 - 0
include/ode/odeconfig.h

@@ -102,9 +102,14 @@
 #if defined(_MSC_VER)
   typedef __int64         dint64;
   typedef unsigned __int64 duint64;
+#else
+#if defined(_LP64)
+typedef long              dint64;
+typedef unsigned long     duint64;
 #else
   typedef long long       dint64;
   typedef unsigned long long duint64;
+#endif
 #endif
   typedef int             dint32;
   typedef unsigned int    duint32;

+ 3 - 3
include/ode/threading.h

@@ -150,9 +150,9 @@ typedef struct dxCallReleasee *dCallReleaseeID;
 struct dxCallWait;
 typedef struct dxCallWait *dCallWaitID;
 
-typedef size_t ddependencycount_t;
-typedef ptrdiff_t ddependencychange_t;
-typedef size_t dcallindex_t;
+typedef dsizeint ddependencycount_t;
+typedef ddiffint ddependencychange_t;
+typedef dsizeint dcallindex_t;
 typedef int dThreadedCallFunction(void *call_context, dcallindex_t instance_index, 
   dCallReleaseeID this_releasee);
 

+ 1 - 1
include/ode/threading_impl.h

@@ -221,7 +221,7 @@ ODE_API void dExternalThreadingServeMultiThreadedImplementation(dThreadingImplem
  * @see dThreadingFreeThreadPool
  */
 ODE_API dThreadingThreadPoolID dThreadingAllocateThreadPool(unsigned thread_count, 
-  size_t stack_size, unsigned int ode_data_allocate_flags, void *reserved/*=NULL*/);
+  dsizeint stack_size, unsigned int ode_data_allocate_flags, void *reserved/*=NULL*/);
 
 /**
  * @brief Commands an instance of built-in thread pool to serve a built-in multi-threaded 

+ 1 - 1
ode/demo/demo_boxstack.cpp

@@ -212,7 +212,7 @@ static char locase(char c)
 
 static void command(int cmd)
 {
-    size_t i;
+    dsizeint i;
     int j,k;
     dReal sides[3];
     dMass m;

+ 1 - 1
ode/demo/demo_chain2.cpp

@@ -145,7 +145,7 @@ int main (int argc, char **argv)
     m.setBox (1,SIDE,SIDE,SIDE);
     m.adjust (MASS);
     body[i].setMass (&m);
-    body[i].setData ((void*)(size_t)i);
+    body[i].setData ((void*)(dsizeint)i);
 
     box[i].create (space,SIDE,SIDE,SIDE);
     box[i].setBody (body[i]);

+ 1 - 1
ode/demo/demo_heightfield.cpp

@@ -246,7 +246,7 @@ char locase(char c)
 
 static void command(int cmd)
 {
-    size_t i;
+    dsizeint i;
     int j,k;
     dReal sides[3];
     dMass m;

+ 1 - 1
ode/demo/demo_motion.cpp

@@ -243,7 +243,7 @@ char locase (char c)
 
 static void command (int cmd)
 {
-    size_t i;
+    dsizeint i;
     int k;
     dReal sides[3];
     dMass m;

+ 1 - 1
ode/demo/demo_moving_convex.cpp

@@ -194,7 +194,7 @@ static void command( int cmd )
 			dRFromAxisAndAngle( R,0,0,1,dRandReal()*10.0-5.0 );
 		}
 		dBodySetRotation( obj[i].body,R );
-		dBodySetData( obj[i].body,( void* )( size_t )i );
+		dBodySetData( obj[i].body,( void* )( dsizeint )i );
 
 		if ( cmd == 'b' )
 		{

+ 1 - 1
ode/demo/demo_moving_trimesh.cpp

@@ -273,7 +273,7 @@ static void command (int cmd)
             dRFromAxisAndAngle (R,0,0,1,dRandReal()*10.0-5.0);
         }
         dBodySetRotation (obj[i].body,R);
-        dBodySetData (obj[i].body,(void*)(size_t)i);
+        dBodySetData (obj[i].body,(void*)(dsizeint)i);
 
         if (cmd == 'b') {
             dMassSetBox (&m,DENSITY,sides[0],sides[1],sides[2]);

+ 13 - 13
ode/demo/demo_ode.cpp

@@ -31,7 +31,7 @@
 // matrix sizes
 
 #define dALIGN_SIZE(buf_size, alignment) (((buf_size) + (alignment - 1)) & (int)(~(alignment - 1))) // Casting the mask to int ensures sign-extension to larger integer sizes
-#define dALIGN_PTR(buf_ptr, alignment) ((void *)(((uintptr_t)(buf_ptr) + ((alignment) - 1)) & (int)(~(alignment - 1)))) // Casting the mask to int ensures sign-extension to larger integer sizes
+#define dALIGN_PTR(buf_ptr, alignment) ((void *)(((duintptr)(buf_ptr) + ((alignment) - 1)) & (int)(~(alignment - 1)))) // Casting the mask to int ensures sign-extension to larger integer sizes
 
 #define MSIZE 21
 #define MSIZE4 dALIGN_SIZE(MSIZE, 4)	// MSIZE rounded up to 4
@@ -331,7 +331,7 @@ void testSmallMatrixMultiply()
 
 void testCholeskyFactorization()
 {
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *B = (dReal *)dAlloc(matrixSize), *C = (dReal *)dAlloc(matrixSize), diff;
 
     HEADER;
@@ -354,7 +354,7 @@ void testCholeskyFactorization()
 
 void testCholeskySolve()
 {
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize);
     dReal *b = (dReal *)dAlloc(vectorSize), *x = (dReal *)dAlloc(vectorSize), *btest = (dReal *)dAlloc(vectorSize), diff;
 
@@ -394,7 +394,7 @@ void testCholeskySolve()
 void testInvertPDMatrix()
 {
     int i,j,ok;
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *Ainv = (dReal *)dAlloc(matrixSize), *I = (dReal *)dAlloc(matrixSize);
 
     HEADER;
@@ -428,7 +428,7 @@ void testInvertPDMatrix()
 
 void testIsPositiveDefinite()
 {
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *B = (dReal *)dAlloc(matrixSize);
 
     HEADER;
@@ -446,7 +446,7 @@ void testIsPositiveDefinite()
 void testFastLDLTFactorization()
 {
     int i,j;
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize), *DL = (dReal *)dAlloc(matrixSize),
         *ATEST = (dReal *)dAlloc(matrixSize), *d = (dReal *)dAlloc(vectorSize), diff;
 
@@ -483,9 +483,9 @@ void testCoopLDLTFactorization()
 {
     int i,j;
 
-    const size_t COOP_MSIZE = MSIZE * 51, COOP_MSIZE4 = dALIGN_SIZE(COOP_MSIZE, 4);
+    const dsizeint COOP_MSIZE = MSIZE * 51, COOP_MSIZE4 = dALIGN_SIZE(COOP_MSIZE, 4);
 
-    size_t matrixSize = sizeof(dReal) * COOP_MSIZE4 * COOP_MSIZE, vectorSize = sizeof(dReal) * COOP_MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * COOP_MSIZE4 * COOP_MSIZE, vectorSize = sizeof(dReal) * COOP_MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize), *DL = (dReal *)dAlloc(matrixSize),
         *ATEST = (dReal *)dAlloc(matrixSize), *d = (dReal *)dAlloc(vectorSize), diff;
 
@@ -551,7 +551,7 @@ void testCoopLDLTFactorization()
 
 void testSolveLDLT()
 {
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize), 
         *d = (dReal *)dAlloc(vectorSize), *x = (dReal *)dAlloc(vectorSize), 
         *b = (dReal *)dAlloc(vectorSize), *btest = (dReal *)dAlloc(vectorSize), diff;
@@ -583,9 +583,9 @@ void testSolveLDLT()
 
 void testCoopSolveLDLT()
 {
-    const size_t COOP_MSIZE = MSIZE * 51, COOP_MSIZE4 = dALIGN_SIZE(COOP_MSIZE, 4);
+    const dsizeint COOP_MSIZE = MSIZE * 51, COOP_MSIZE4 = dALIGN_SIZE(COOP_MSIZE, 4);
 
-    size_t matrixSize = sizeof(dReal) * COOP_MSIZE4 * COOP_MSIZE, vectorSize = sizeof(dReal) * COOP_MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * COOP_MSIZE4 * COOP_MSIZE, vectorSize = sizeof(dReal) * COOP_MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize), 
         *d = (dReal *)dAlloc(vectorSize), *x = (dReal *)dAlloc(vectorSize), 
         *b = (dReal *)dAlloc(vectorSize), *btest = (dReal *)dAlloc(vectorSize), diff;
@@ -653,7 +653,7 @@ void testCoopSolveLDLT()
 void testLDLTAddTL()
 {
     int i,j;
-    size_t matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
+    dsizeint matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize), 
         *DL = (dReal *)dAlloc(matrixSize), *ATEST = (dReal *)dAlloc(matrixSize), 
         *d = (dReal *)dAlloc(vectorSize), *a = (dReal *)dAlloc(vectorSize), diff;
@@ -700,7 +700,7 @@ void testLDLTAddTL()
 void testLDLTRemove()
 {
     int i,j,r;
-    size_t intVectorSize = sizeof(int) * MSIZE, matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
+    dsizeint intVectorSize = sizeof(int) * MSIZE, matrixSize = sizeof(dReal) * MSIZE4 * MSIZE, vectorSize = sizeof(dReal) * MSIZE;
     int *p = (int *)dAlloc(intVectorSize);
     dReal *A = (dReal *)dAlloc(matrixSize), *L = (dReal *)dAlloc(matrixSize), 
         *L2 = (dReal *)dAlloc(matrixSize), *DL2 = (dReal *)dAlloc(matrixSize), 

+ 1 - 1
ode/demo/demo_plane2d.cpp

@@ -250,7 +250,7 @@ extern int      main
 
         g_globals_ptr->dyn_bodies[b].create (g_globals_ptr->dyn_world);
         g_globals_ptr->dyn_bodies[b].setPosition (x, y, z/2);
-        g_globals_ptr->dyn_bodies[b].setData ((void*) (size_t)b);
+        g_globals_ptr->dyn_bodies[b].setData ((void*) (dsizeint)b);
         dBodySetLinearVel (g_globals_ptr->dyn_bodies[b].id (),
             dReal( 3 * (drand48 () - 0.5) ), 
 			dReal( 3 * (drand48 () - 0.5) ), 0);

+ 7 - 7
ode/demo/demo_space.cpp

@@ -61,9 +61,9 @@ testing procedure:
 static dSpaceID space;
 static dGeomID geom[NUM];
 static dReal bounds[NUM][6];
-static size_t good_matrix[NUM][NUM];	// correct collision matrix
-static size_t test_matrix[NUM][NUM];	// testing collision matrix
-static size_t hits[NUM];		// number of collisions a box has
+static dsizeint good_matrix[NUM][NUM];	// correct collision matrix
+static dsizeint test_matrix[NUM][NUM];	// testing collision matrix
+static dsizeint hits[NUM];		// number of collisions a box has
 static unsigned long seed=37;
 
 
@@ -91,7 +91,7 @@ static void init_test()
 		      (bounds[i][0] + bounds[i][1])*0.5,
 		      (bounds[i][2] + bounds[i][3])*0.5,
 		      (bounds[i][4] + bounds[i][5])*0.5);
-    dGeomSetData (geom[i],(void*)(size_t)(i));
+    dGeomSetData (geom[i],(void*)(dsizeint)(i));
   }
 
   // compute all intersections and put the results in "good_matrix"
@@ -124,9 +124,9 @@ static void init_test()
 
 static void nearCallback (void *, dGeomID o1, dGeomID o2)
 {
-  size_t i,j;
-  i = (size_t) dGeomGetData (o1);
-  j = (size_t) dGeomGetData (o2);
+  dsizeint i,j;
+  i = (dsizeint) dGeomGetData (o1);
+  j = (dsizeint) dGeomGetData (o2);
   if (i==j)
     printf ("collision (%d,%d) is between the same object\n",(int)i,(int)j);
   if (!good_matrix[i][j] || !good_matrix[j][i])

+ 1 - 1
ode/demo/demo_trimesh.cpp

@@ -258,7 +258,7 @@ static void command (int cmd)
       dRFromAxisAndAngle (R,0,0,1,dRandReal()*10.0-5.0);
     }
     dBodySetRotation (obj[i].body,R);
-    dBodySetData (obj[i].body,(void*)(size_t)i);
+    dBodySetData (obj[i].body,(void*)(dsizeint)i);
 
     if (cmd == 'b') {
       dMassSetBox (&m,DENSITY,sides[0],sides[1],sides[2]);

+ 1 - 1
ode/src/collision_libccd.cpp

@@ -274,7 +274,7 @@ void ccdSupportConvex(const void *obj, const ccd_vec3_t *_dir, ccd_vec3_t *v)
     const ccd_convex_t *c = (const ccd_convex_t *)obj;
     ccd_vec3_t dir, p;
     ccd_real_t maxdot, dot;
-    size_t i;
+    sizeint i;
     const dReal *curp;
 
     ccdVec3Copy(&dir, _dir);

+ 4 - 4
ode/src/collision_quadtreespace.cpp

@@ -362,12 +362,12 @@ struct dxQuadTreeSpace : public dxSpace{
 namespace {
 
     inline
-    size_t numNodes(int depth) 
+    sizeint numNodes(int depth) 
     {
         // A 4-ary tree has (4^(depth+1) - 1)/3 nodes
         // Note: split up into multiple constant expressions for readability
         const int k = depth+1;
-        const size_t fourToNthPlusOne = (size_t)1 << (2*k); // 4^k = 2^(2k)
+        const sizeint fourToNthPlusOne = (sizeint)1 << (2*k); // 4^k = 2^(2k)
         return (fourToNthPlusOne - 1) / 3;
     }
 
@@ -378,7 +378,7 @@ namespace {
 dxQuadTreeSpace::dxQuadTreeSpace(dSpaceID _space, const dVector3 Center, const dVector3 Extents, int Depth) : dxSpace(_space){
     type = dQuadTreeSpaceClass;
 
-    size_t BlockCount = numNodes(Depth);
+    sizeint BlockCount = numNodes(Depth);
 
     Blocks = (Block*)dAlloc(BlockCount * sizeof(Block));
     Block* Blocks = this->Blocks + 1;	// This pointer gets modified!
@@ -412,7 +412,7 @@ dxQuadTreeSpace::~dxQuadTreeSpace(){
         Current = Current->mChildren;
     }
 
-    size_t BlockCount = numNodes(Depth);
+    sizeint BlockCount = numNodes(Depth);
 
     dFree(Blocks, BlockCount * sizeof(Block));
     dFree(CurrentChild, (Depth + 1) * sizeof(int));

+ 16 - 16
ode/src/collision_sapspace.cpp

@@ -62,16 +62,16 @@ public:
 
 private:
     void FreeRanks();
-    void AllocateRanks(size_t nNewSize);
+    void AllocateRanks(sizeint nNewSize);
 
-    void ReallocateRanksIfNecessary(size_t nNewSize);
+    void ReallocateRanksIfNecessary(sizeint nNewSize);
 
 private:
-    void SetCurrentSize(size_t nValue) { mCurrentSize = nValue; }
-    size_t GetCurrentSize() const { return mCurrentSize; }
+    void SetCurrentSize(sizeint nValue) { mCurrentSize = nValue; }
+    sizeint GetCurrentSize() const { return mCurrentSize; }
 
-    void SetCurrentUtilization(size_t nValue) { mCurrentUtilization = nValue; }
-    size_t GetCurrentUtilization() const { return mCurrentUtilization; }
+    void SetCurrentUtilization(sizeint nValue) { mCurrentUtilization = nValue; }
+    sizeint GetCurrentUtilization() const { return mCurrentUtilization; }
 
     uint32 *GetRanks1() const { return mPrimaryRanks; }
     uint32 *GetRanks2() const { return mRanksBuffer + ((mRanksBuffer + mCurrentSize) - mPrimaryRanks); }
@@ -82,14 +82,14 @@ private:
     void ValidateRanks() { mRanksValid = true; }
 
 private:
-    size_t mCurrentSize;						//!< Current size of the indices list
-    size_t mCurrentUtilization;					//!< Current utilization of the indices list
+    sizeint mCurrentSize;						//!< Current size of the indices list
+    sizeint mCurrentUtilization;					//!< Current utilization of the indices list
     bool mRanksValid;
     uint32* mRanksBuffer;						//!< Two lists allocated sequentially in a single block
     uint32* mPrimaryRanks;
 };
 
-void RaixSortContext::AllocateRanks(size_t nNewSize)
+void RaixSortContext::AllocateRanks(sizeint nNewSize)
 {
     dIASSERT(GetCurrentSize() == 0);
 
@@ -106,13 +106,13 @@ void RaixSortContext::FreeRanks()
     delete[] mRanksBuffer;
 }
 
-void RaixSortContext::ReallocateRanksIfNecessary(size_t nNewSize)
+void RaixSortContext::ReallocateRanksIfNecessary(sizeint nNewSize)
 {
-    size_t nCurUtilization = GetCurrentUtilization();
+    sizeint nCurUtilization = GetCurrentUtilization();
 
     if (nNewSize != nCurUtilization)
     {
-        size_t nCurSize = GetCurrentSize();
+        sizeint nCurSize = GetCurrentSize();
 
         if ( nNewSize > nCurSize )
         {
@@ -220,10 +220,10 @@ dSpaceID dSweepAndPruneSpaceCreate( dxSpace* space, int axisorder ) {
 #define GEOM_ENABLED(g) (((g)->gflags & GEOM_ENABLE_TEST_MASK) == GEOM_ENABLE_TEST_VALUE)
 
 // HACK: We abuse 'next' and 'tome' members of dxGeom to store indices into dirty/geom lists.
-#define GEOM_SET_DIRTY_IDX(g,idx) { (g)->next_ex = (dxGeom*)(size_t)(idx); }
-#define GEOM_SET_GEOM_IDX(g,idx) { (g)->tome_ex = (dxGeom**)(size_t)(idx); }
-#define GEOM_GET_DIRTY_IDX(g) ((int)(size_t)(g)->next_ex)
-#define GEOM_GET_GEOM_IDX(g) ((int)(size_t)(g)->tome_ex)
+#define GEOM_SET_DIRTY_IDX(g,idx) { (g)->next_ex = (dxGeom*)(sizeint)(idx); }
+#define GEOM_SET_GEOM_IDX(g,idx) { (g)->tome_ex = (dxGeom**)(sizeint)(idx); }
+#define GEOM_GET_DIRTY_IDX(g) ((int)(sizeint)(g)->next_ex)
+#define GEOM_GET_GEOM_IDX(g) ((int)(sizeint)(g)->tome_ex)
 #define GEOM_INVALID_IDX (-1)
 
 

+ 4 - 4
ode/src/collision_space.cpp

@@ -306,7 +306,7 @@ struct dxAABB {
     int level;		// the level this is stored in (cell size = 2^level)
     int dbounds[6];	// AABB bounds, discretized to cell size
     dxGeom *geom;		// corresponding geometry object (AABB stored here)
-    size_t index;		// index of this AABB, starting from 0
+    sizeint index;		// index of this AABB, starting from 0
 };
 
 
@@ -470,7 +470,7 @@ void dxHashSpace::collide (void *data, dNearCallback *callback)
         }
     }
 
-    size_t n = hash_boxes.size(); // number of AABBs in main list
+    sizeint n = hash_boxes.size(); // number of AABBs in main list
 
     // for `n' objects, an n*n array of bits is used to record if those objects
     // have been intersection-tested against each other yet. this array can
@@ -484,7 +484,7 @@ void dxHashSpace::collide (void *data, dNearCallback *callback)
 
     // compute hash table size sz to be a prime > 8*n
     for (i=0; i<NUM_PRIMES; i++) {
-        if ((size_t)prime[i] >= (8*n)) break;
+        if ((sizeint)prime[i] >= (8*n)) break;
     }
     if (i >= NUM_PRIMES) {
         i = NUM_PRIMES-1;	// probably pointless
@@ -560,7 +560,7 @@ void dxHashSpace::collide (void *data, dNearCallback *callback)
                                         i = (node->aabb->index * tested_rowsize)+(aabb->index >> 3);
                                         mask = 1 << (aabb->index & 7);
                                     }
-                                    dIASSERT (i >= 0 && (size_t)i < (tested_rowsize*n));
+                                    dIASSERT (i >= 0 && (sizeint)i < (tested_rowsize*n));
                                     if ((tested[i] & mask)==0) {
                                         tested[i] |= mask;
                                         collideAABBs (aabb->geom,node->aabb->geom,data,callback);

+ 2 - 2
ode/src/collision_trimesh_disabled.cpp

@@ -91,7 +91,7 @@ void *dGeomTriMeshDataGet(dTriMeshDataID g, int data_id)
 }
 
 /*extern */
-void *dGeomTriMeshDataGet2(dTriMeshDataID g, int data_id, size_t *pout_size/*=NULL*/)
+void *dGeomTriMeshDataGet2(dTriMeshDataID g, int data_id, sizeint *pout_size/*=NULL*/)
 {
     if (pout_size != NULL)
     {
@@ -199,7 +199,7 @@ int dGeomTriMeshDataPreprocess(dTriMeshDataID g)
 }
 
 /*extern ODE_API */
-int dGeomTriMeshDataPreprocess2(dTriMeshDataID g, unsigned int buildRequestFlags, const dintptr *requestExtraData/*=NULL | const dintptr (*)[dTRIDATAPREPROCESS_BUILD__MAX]*/)
+int dGeomTriMeshDataPreprocess2(dTriMeshDataID g, unsigned int buildRequestFlags, const intptr *requestExtraData/*=NULL | const intptr (*)[dTRIDATAPREPROCESS_BUILD__MAX]*/)
 {
     // Do nothing
     return 1;

+ 10 - 10
ode/src/collision_trimesh_gimpact.cpp

@@ -75,7 +75,7 @@ struct TrimeshDataVertexIndexAccessor_GIMPACT
         const GUINT32 *triIndicesBegin = m_TriangleVertexIndices;
         const unsigned triStride = TRIANGLEINDEX_STRIDE;
 
-        const GUINT32 *triIndicesOfInterest = (const GUINT32 *)((const uint8 *)triIndicesBegin + (size_t)triangleIdx * triStride);
+        const GUINT32 *triIndicesOfInterest = (const GUINT32 *)((const uint8 *)triIndicesBegin + (sizeint)triangleIdx * triStride);
         std::copy(triIndicesOfInterest, triIndicesOfInterest + dMTV__MAX, out_VertexIndices);
     }
 
@@ -132,12 +132,12 @@ bool dxTriMeshData::meaningfulPreprocessData(FaceAngleStorageMethod faceAndgesRe
 
         const unsigned int numTris = retrieveTriangleCount();
         const unsigned int numVertices = retrieveVertexCount();
-        size_t numEdges = (size_t)numTris * dMTV__MAX;
+        sizeint numEdges = (sizeint)numTris * dMTV__MAX;
         dIASSERT(numVertices <= numEdges); // Edge records are going to be used for vertex data as well
 
-        const size_t recordsMemoryRequired = dEFFICIENT_SIZE(numEdges * sizeof(EdgeRecord));
-        const size_t verticesMemoryRequired = /*dEFFICIENT_SIZE*/(numVertices * sizeof(VertexRecord)); // Skip alignment for the last chunk
-        const size_t totalTempMemoryRequired = recordsMemoryRequired + verticesMemoryRequired;
+        const sizeint recordsMemoryRequired = dEFFICIENT_SIZE(numEdges * sizeof(EdgeRecord));
+        const sizeint verticesMemoryRequired = /*dEFFICIENT_SIZE*/(numVertices * sizeof(VertexRecord)); // Skip alignment for the last chunk
+        const sizeint totalTempMemoryRequired = recordsMemoryRequired + verticesMemoryRequired;
         void *tempBuffer = dAlloc(totalTempMemoryRequired);
 
         if (tempBuffer == NULL)
@@ -226,8 +226,8 @@ void dxTriMesh::assignMeshData(dxTriMeshData *Data)
     {
         const GUINT32 *triangleVertexIndices = Data->retrieveTriangleVertexIndices();
 
-        size_t vertexInstanceCount = Data->retrieveVertexCount();
-        size_t triangleVertexCount = (size_t)Data->retrieveTriangleCount() * dMTV__MAX;
+        sizeint vertexInstanceCount = Data->retrieveVertexCount();
+        sizeint triangleVertexCount = (sizeint)Data->retrieveTriangleCount() * dMTV__MAX;
 
         gim_trimesh_create_from_data(
             m_buffer_managers,
@@ -288,7 +288,7 @@ void dGeomTriMeshDataSet(dTriMeshDataID g, int dataId, void *pDataLocation)
     }
 }
 
-static void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, size_t *pOutDataSize) ;
+static void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, sizeint *pOutDataSize) ;
 
 /*extern */
 void *dGeomTriMeshDataGet(dTriMeshDataID g, int dataId) 
@@ -297,13 +297,13 @@ void *dGeomTriMeshDataGet(dTriMeshDataID g, int dataId)
 }
 
 /*extern */
-void *dGeomTriMeshDataGet2(dTriMeshDataID g, int dataId, size_t *pOutDataSize) 
+void *dGeomTriMeshDataGet2(dTriMeshDataID g, int dataId, sizeint *pOutDataSize) 
 {
     return geomTriMeshDataGet(g, dataId, pOutDataSize);
 }
 
 static 
-void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, size_t *pOutDataSize) 
+void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, sizeint *pOutDataSize) 
 {
     dUASSERT(g, "The argument is not a trimesh data");
 

+ 1 - 1
ode/src/collision_trimesh_gimpact.h

@@ -82,7 +82,7 @@ public:
 public:
     void assignNormals(const dReal *normals) { dxTriMeshData_Parent::assignNormals(normals); }
     const dReal *retrieveNormals() const { return (const dReal *)dxTriMeshData_Parent::retrieveNormals(); }
-    size_t calculateNormalsMemoryRequirement() const { return retrieveTriangleCount() * (sizeof(dReal) * dSA__MAX); }
+    sizeint calculateNormalsMemoryRequirement() const { return retrieveTriangleCount() * (sizeof(dReal) * dSA__MAX); }
 };
 
 

+ 11 - 11
ode/src/collision_trimesh_internal.cpp

@@ -156,7 +156,7 @@ public:
 
     static IFaceAngleStorageControl *allocateInstance(unsigned triangleCount, IFaceAngleStorageView *&out_storageView);
 
-    static bool calculateInstanceSizeRequired(size_t &out_sizeRequired, unsigned triangleCount);
+    static bool calculateInstanceSizeRequired(sizeint &out_sizeRequired, unsigned triangleCount);
 
 private:
     void freeInstance();
@@ -173,19 +173,19 @@ private:
         TriangleFaceAngles  m_triangleFaceAngles[1];
     };
 
-    static size_t calculateStorageSizeForTriangleCount(unsigned triangleCount)
+    static sizeint calculateStorageSizeForTriangleCount(unsigned triangleCount)
     {
         const unsigned baseIncludedTriangleCount = dSTATIC_ARRAY_SIZE(FaceAnglesWrapper<TStorageCodec>::StorageRecord, m_triangleFaceAngles);
-        const size_t singleTriangleSize = membersize(FaceAnglesWrapper<TStorageCodec>::StorageRecord, m_triangleFaceAngles[0]);
+        const sizeint singleTriangleSize = membersize(FaceAnglesWrapper<TStorageCodec>::StorageRecord, m_triangleFaceAngles[0]);
         return sizeof(FaceAnglesWrapper<TStorageCodec>) + (triangleCount > baseIncludedTriangleCount ? (triangleCount - baseIncludedTriangleCount) * singleTriangleSize : 0U);
     }
 
-    static size_t calculateTriangleCountForStorageSize(size_t storageSize)
+    static sizeint calculateTriangleCountForStorageSize(sizeint storageSize)
     {
         dIASSERT(storageSize >= sizeof(FaceAnglesWrapper<TStorageCodec>));
 
         const unsigned baseIncludedTriangleCount = dSTATIC_ARRAY_SIZE(FaceAnglesWrapper<TStorageCodec>::StorageRecord, m_triangleFaceAngles);
-        const size_t singleTriangleSize = membersize(FaceAnglesWrapper<TStorageCodec>::StorageRecord, m_triangleFaceAngles[0]);
+        const sizeint singleTriangleSize = membersize(FaceAnglesWrapper<TStorageCodec>::StorageRecord, m_triangleFaceAngles[0]);
         return (storageSize - sizeof(FaceAnglesWrapper<TStorageCodec>)) / singleTriangleSize + baseIncludedTriangleCount;
     }
 
@@ -243,7 +243,7 @@ IFaceAngleStorageControl *FaceAnglesWrapper<TStorageCodec>::allocateInstance(uns
 
     do
     {
-        size_t sizeRequired;
+        sizeint sizeRequired;
         if (!FaceAnglesWrapper<TStorageCodec>::calculateInstanceSizeRequired(sizeRequired, triangleCount))
         {
             break;
@@ -267,13 +267,13 @@ IFaceAngleStorageControl *FaceAnglesWrapper<TStorageCodec>::allocateInstance(uns
 
 template<class TStorageCodec>
 /*static */
-bool FaceAnglesWrapper<TStorageCodec>::calculateInstanceSizeRequired(size_t &out_sizeRequired, unsigned triangleCount)
+bool FaceAnglesWrapper<TStorageCodec>::calculateInstanceSizeRequired(sizeint &out_sizeRequired, unsigned triangleCount)
 {
     bool result = false;
 
     do
     {
-        size_t triangleMaximumCount = calculateTriangleCountForStorageSize(SIZE_MAX);
+        sizeint triangleMaximumCount = calculateTriangleCountForStorageSize(SIZE_MAX);
         dIASSERT(triangleCount <= triangleMaximumCount);
 
         if (triangleCount > triangleMaximumCount) // Check for overflow
@@ -296,7 +296,7 @@ void FaceAnglesWrapper<TStorageCodec>::freeInstance()
 
     this->FaceAnglesWrapper<TStorageCodec>::~FaceAnglesWrapper();
 
-    size_t memoryBlockSize = calculateStorageSizeForTriangleCount(triangleCount);
+    sizeint memoryBlockSize = calculateStorageSizeForTriangleCount(triangleCount);
     dFree(this, memoryBlockSize);
 }
 
@@ -548,7 +548,7 @@ END_NAMESPACE_OU();
 static const CEnumUnsortedElementArray<unsigned, dTRIDATAPREPROCESS_FACE_ANGLES_EXTRA__MAX, FaceAngleStorageMethod, 0x17010902> g_TriMeshDataPreprocess_FaceAndlesExtraDataAngleStorageMethods;
 
 /*extern ODE_API */
-int dGeomTriMeshDataPreprocess2(dTriMeshDataID g, unsigned int buildRequestFlags, const dintptr *requestExtraData/*=NULL | const dintptr (*)[dTRIDATAPREPROCESS_BUILD__MAX]*/)
+int dGeomTriMeshDataPreprocess2(dTriMeshDataID g, unsigned int buildRequestFlags, const intptr *requestExtraData/*=NULL | const intptr (*)[dTRIDATAPREPROCESS_BUILD__MAX]*/)
 {
     dUASSERT(g, "The argument is not a trimesh data");
     dAASSERT((buildRequestFlags & (1U << dTRIDATAPREPROCESS_BUILD_FACE_ANGLES)) == 0 || requestExtraData == NULL || dIN_RANGE(requestExtraData[dTRIDATAPREPROCESS_BUILD_FACE_ANGLES], dTRIDATAPREPROCESS_FACE_ANGLES_EXTRA__MIN, dTRIDATAPREPROCESS_FACE_ANGLES_EXTRA__MAX));
@@ -782,7 +782,7 @@ IFaceAngleStorageView *dxGeomTriMeshGetFaceAngleView(dxGeom *triMeshGeom)
 /*extern */
 void dGeomTriMeshDataGetBuffer(dTriMeshDataID g, unsigned char **buf, int *bufLen)
 {
-    size_t dataSizeStorage;
+    sizeint dataSizeStorage;
     void *dataPointer = dGeomTriMeshDataGet2(g, dTRIMESHDATA_USE_FLAGS, (bufLen != NULL ? &dataSizeStorage : NULL));
 
     if (bufLen != NULL)

+ 2 - 2
ode/src/collision_trimesh_internal.h

@@ -258,10 +258,10 @@ protected:
     };
 
     template<class TMeshDataAccessor>
-    static void meaningfulPreprocess_SetupEdgeRecords(EdgeRecord *edges, size_t numEdges, const TMeshDataAccessor &dataAccessor);
+    static void meaningfulPreprocess_SetupEdgeRecords(EdgeRecord *edges, sizeint numEdges, const TMeshDataAccessor &dataAccessor);
     template<class TMeshDataAccessor>
     static void meaningfulPreprocess_buildEdgeFlags(uint8 *useFlags/*=NULL*/, IFaceAngleStorageControl *faceAngles/*=NULL*/, 
-        EdgeRecord *edges, size_t numEdges, VertexRecord *vertices, 
+        EdgeRecord *edges, sizeint numEdges, VertexRecord *vertices, 
         const dReal *externalNormals, const TMeshDataAccessor &dataAccessor);
     static void buildBoundaryEdgeAngle(IFaceAngleStorageControl *faceAngles, EdgeRecord *currEdge);
     template<class TMeshDataAccessor>

+ 5 - 5
ode/src/collision_trimesh_internal_impl.h

@@ -38,11 +38,11 @@ template<typename tcoordfloat, typename tindexint>
 void dxTriDataBase::retrieveTriangleVertexPoints(dVector3 out_Points[dMTV__MAX], unsigned triangleIndex,
     const tcoordfloat *vertexInstances, int vertexStride, const tindexint *triangleVertexIndices, int triangleStride)
 {
-    const tindexint *triangleIndicesOfInterest = (const tindexint *)((uint8 *)triangleVertexIndices + (size_t)triangleIndex * triangleStride);
+    const tindexint *triangleIndicesOfInterest = (const tindexint *)((uint8 *)triangleVertexIndices + (sizeint)triangleIndex * triangleStride);
     for (unsigned trianglePoint = dMTV__MIN; trianglePoint != dMTV__MAX; ++trianglePoint)
     {
         unsigned vertexIndex = triangleIndicesOfInterest[trianglePoint];
-        tcoordfloat *pointVertex = (tcoordfloat *)((uint8 *)vertexInstances + (size_t)vertexIndex * vertexStride);
+        tcoordfloat *pointVertex = (tcoordfloat *)((uint8 *)vertexInstances + (sizeint)vertexIndex * vertexStride);
         dAssignVector3(out_Points[trianglePoint], (dReal)pointVertex[dSA_X], (dReal)pointVertex[dSA_Y], (dReal)pointVertex[dSA_Z]);
         dSASSERT(dSA_X == 0);
         dSASSERT(dSA_Y == 1);
@@ -53,12 +53,12 @@ void dxTriDataBase::retrieveTriangleVertexPoints(dVector3 out_Points[dMTV__MAX],
 
 template<class TMeshDataAccessor>
 /*static */
-void dxTriDataBase::meaningfulPreprocess_SetupEdgeRecords(EdgeRecord *edges, size_t numEdges, const TMeshDataAccessor &dataAccessor)
+void dxTriDataBase::meaningfulPreprocess_SetupEdgeRecords(EdgeRecord *edges, sizeint numEdges, const TMeshDataAccessor &dataAccessor)
 {
     unsigned vertexIndices[dMTV__MAX];
     // Make a list of every edge in the mesh
     unsigned triangleIdx = 0;
-    for (size_t edgeIdx = 0; edgeIdx != numEdges; ++triangleIdx, edgeIdx += dMTV__MAX)
+    for (sizeint edgeIdx = 0; edgeIdx != numEdges; ++triangleIdx, edgeIdx += dMTV__MAX)
     {
         dataAccessor.getTriangleVertexIndices(vertexIndices, triangleIdx);
         edges[edgeIdx + dMTV_FIRST].setupEdge(dMTV_FIRST, triangleIdx, vertexIndices);
@@ -70,7 +70,7 @@ void dxTriDataBase::meaningfulPreprocess_SetupEdgeRecords(EdgeRecord *edges, siz
 template<class TMeshDataAccessor>
 /*static */
 void dxTriDataBase::meaningfulPreprocess_buildEdgeFlags(uint8 *useFlags/*=NULL*/, IFaceAngleStorageControl *faceAngles/*=NULL*/, 
-    EdgeRecord *edges, size_t numEdges, VertexRecord *vertices, 
+    EdgeRecord *edges, sizeint numEdges, VertexRecord *vertices, 
     const dReal *externalNormals/*=NULL*/, const TMeshDataAccessor &dataAccessor)
 {
     dIASSERT(useFlags != NULL || faceAngles != NULL);

+ 11 - 11
ode/src/collision_trimesh_opcode.cpp

@@ -91,7 +91,7 @@ dxTriMeshData::~dxTriMeshData()
 {
     if ( m_InternalUseFlags != NULL )
     {
-        size_t flagsMemoryRequired = calculateUseFlagsMemoryRequirement();
+        sizeint flagsMemoryRequired = calculateUseFlagsMemoryRequirement();
         dFree(m_InternalUseFlags, flagsMemoryRequired);
     }
 }
@@ -214,7 +214,7 @@ struct TrimeshDataVertexIndexAccessor_OPCODE
         const IndexedTriangle *triIndicesBegin = m_TriIndicesBegin;
         const unsigned triStride = m_TriStride;
 
-        const IndexedTriangle *triIndicesOfInterest = (const IndexedTriangle *)((const uint8 *)triIndicesBegin + triangleIdx * (size_t)triStride);
+        const IndexedTriangle *triIndicesOfInterest = (const IndexedTriangle *)((const uint8 *)triIndicesBegin + triangleIdx * (sizeint)triStride);
         std::copy(triIndicesOfInterest->mVRef, triIndicesOfInterest->mVRef + dMTV__MAX, out_VertexIndices);
         dSASSERT(dMTV__MAX == dARRAY_SIZE(triIndicesOfInterest->mVRef));
         dSASSERT(dMTV_FIRST == 0);
@@ -264,7 +264,7 @@ bool dxTriMeshData::meaningfulPreprocessData(bool buildUseFlags/*=false*/, FaceA
     bool result = false;
 
     uint8 *useFlags = NULL;
-    size_t flagsMemoryRequired = 0;
+    sizeint flagsMemoryRequired = 0;
     bool flagsAllocated = false, anglesAllocated = false;
 
     do 
@@ -294,12 +294,12 @@ bool dxTriMeshData::meaningfulPreprocessData(bool buildUseFlags/*=false*/, FaceA
 
         const unsigned int numTris = m_Mesh.GetNbTriangles();
         const unsigned int numVertices = m_Mesh.GetNbVertices();
-        size_t numEdges = (size_t)numTris * dMTV__MAX;
+        sizeint numEdges = (sizeint)numTris * dMTV__MAX;
         dIASSERT(numVertices <= numEdges); // Edge records are going to be used for vertex data as well
 
-        const size_t recordsMemoryRequired = dEFFICIENT_SIZE(numEdges * sizeof(EdgeRecord));
-        const size_t verticesMemoryRequired = /*dEFFICIENT_SIZE*/(numVertices * sizeof(VertexRecord)); // Skip alignment for the last chunk
-        const size_t totalTempMemoryRequired = recordsMemoryRequired + verticesMemoryRequired;
+        const sizeint recordsMemoryRequired = dEFFICIENT_SIZE(numEdges * sizeof(EdgeRecord));
+        const sizeint verticesMemoryRequired = /*dEFFICIENT_SIZE*/(numVertices * sizeof(VertexRecord)); // Skip alignment for the last chunk
+        const sizeint totalTempMemoryRequired = recordsMemoryRequired + verticesMemoryRequired;
         void *tempBuffer = dAlloc(totalTempMemoryRequired);
         
         if (tempBuffer == NULL)
@@ -618,22 +618,22 @@ void dGeomTriMeshDataSet(dTriMeshDataID g, int dataId, void *pDataLocation)
     }
 }
 
-static void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, size_t *pOutDataSize);
+static void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, sizeint *pOutDataSize);
 
 /*extern */
-void *dGeomTriMeshDataGet(dTriMeshDataID g, int dataId, size_t *pOutDataSize)
+void *dGeomTriMeshDataGet(dTriMeshDataID g, int dataId, sizeint *pOutDataSize)
 {
     return geomTriMeshDataGet(g, dataId, NULL);
 }
 
 /*extern */
-void *dGeomTriMeshDataGet2(dTriMeshDataID g, int dataId, size_t *pOutDataSize)
+void *dGeomTriMeshDataGet2(dTriMeshDataID g, int dataId, sizeint *pOutDataSize)
 {
     return geomTriMeshDataGet(g, dataId, pOutDataSize);
 }
 
 static 
-void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, size_t *pOutDataSize)
+void *geomTriMeshDataGet(dTriMeshDataID g, int dataId, sizeint *pOutDataSize)
 {
     dUASSERT(g, "The argument is not a trimesh data");
 

+ 5 - 5
ode/src/collision_trimesh_opcode.h

@@ -90,7 +90,7 @@ public:
     bool resizeAndResetVertexUSEDFlags(unsigned VertexCount)
     {
         bool Result = false;
-        size_t VertexNewElements = (VertexCount + 7) / 8;
+        sizeint VertexNewElements = (VertexCount + 7) / 8;
         if (VertexNewElements <= m_VertexUseElements || reallocVertexUSEDFlags(VertexNewElements)) {
             memset(m_VertexUseBits, 0, VertexNewElements);
             Result = true;
@@ -102,7 +102,7 @@ public:
     void setVertexUSEDFlag(unsigned VertexIndex) { m_VertexUseBits[VertexIndex / 8] |= (1 << (VertexIndex % 8)); }
 
 private:
-    bool reallocVertexUSEDFlags(size_t VertexNewElements)
+    bool reallocVertexUSEDFlags(sizeint VertexNewElements)
     {
         bool Result = false;
         uint8 *VertexNewBits = (uint8 *)dRealloc(m_VertexUseBits, m_VertexUseElements * sizeof(m_VertexUseBits[0]), VertexNewElements * sizeof(m_VertexUseBits[0]));
@@ -123,7 +123,7 @@ private:
 
 private:
     uint8 *m_VertexUseBits;
-    size_t m_VertexUseElements;
+    sizeint m_VertexUseElements;
 };
 
 
@@ -207,13 +207,13 @@ public:
 public:
     void assignNormals(const dReal *normals) { dxTriMeshData_Parent::assignNormals(normals); }
     const dReal *retrieveNormals() const { return (const dReal *)dxTriMeshData_Parent::retrieveNormals(); }
-    size_t calculateNormalsMemoryRequirement() const { return retrieveTriangleCount() * (sizeof(dReal) * dSA__MAX); }
+    sizeint calculateNormalsMemoryRequirement() const { return retrieveTriangleCount() * (sizeof(dReal) * dSA__MAX); }
 
 public:
     void assignExternalUseFlagsBuffer(uint8 *buffer) { m_ExternalUseFlags = buffer != m_InternalUseFlags ? buffer : NULL; }
     const uint8 *smartRetrieveUseFlags() const { return m_ExternalUseFlags != NULL ? m_ExternalUseFlags : m_InternalUseFlags; }
     bool haveUseFlagsBeenBuilt() const { return m_InternalUseFlags != NULL; }
-    size_t calculateUseFlagsMemoryRequirement() const { return m_Mesh.GetNbTriangles() * sizeof(m_InternalUseFlags[0]); }
+    sizeint calculateUseFlagsMemoryRequirement() const { return m_Mesh.GetNbTriangles() * sizeof(m_InternalUseFlags[0]); }
 
 public:
     Model m_BVTree;

+ 16 - 16
ode/src/common.h

@@ -31,18 +31,18 @@
 
 
 #ifndef SIZE_MAX
-#define SIZE_MAX  ((size_t)(-1))
+#define SIZE_MAX  ((sizeint)(-1))
 #endif
 
 
 #ifndef offsetof
-#define offsetof(s, m) ((size_t)&(((s *)8)->m) - (size_t)8)
+#define offsetof(s, m) ((sizeint)&(((s *)8)->m) - (sizeint)8)
 #endif
 #ifndef membersize
 #define membersize(s, m) (sizeof(((s *)8)->m))
 #endif
 #ifndef endoffsetof
-#define endoffsetof(s, m)   ((size_t)((size_t)&(((s *)8)->m) - (size_t)8) + sizeof(((s *)8)->m))
+#define endoffsetof(s, m)   ((sizeint)((sizeint)&(((s *)8)->m) - (sizeint)8) + sizeof(((s *)8)->m))
 #endif
 
 #define dMACRO_MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -95,12 +95,12 @@ public:
     dxAlignedAllocation(): m_userAreaPointer(NULL), m_bufferAllocated(NULL), m_sizeUsed(0) {}
     ~dxAlignedAllocation() { freeAllocation(); }
 
-    void *allocAligned(size_t sizeRequired, unsigned alignmentRequired)
+    void *allocAligned(sizeint sizeRequired, unsigned alignmentRequired)
     {
         dIASSERT((alignmentRequired & (alignmentRequired - 1)) == 0);
         dIASSERT(alignmentRequired <= SIZE_MAX - sizeRequired);
 
-        size_t sizeToUse = sizeRequired + alignmentRequired;
+        sizeint sizeToUse = sizeRequired + alignmentRequired;
         void *bufferPointer = dAlloc(sizeToUse);
         void *userAreaPointer = bufferPointer != NULL && alignmentRequired != 0 ? dALIGN_PTR(bufferPointer, alignmentRequired) : bufferPointer;
         assignData(userAreaPointer, bufferPointer, sizeToUse);
@@ -109,11 +109,11 @@ public:
     }
 
     void *getUserAreaPointer() const { return m_userAreaPointer; }
-    size_t getUserAreaSize() const { return m_sizeUsed - ((uint8 *)m_userAreaPointer - (uint8 *)m_bufferAllocated); }
+    sizeint getUserAreaSize() const { return m_sizeUsed - ((uint8 *)m_userAreaPointer - (uint8 *)m_bufferAllocated); }
 
     void freeAllocation()
     {
-        size_t sizeUsed;
+        sizeint sizeUsed;
         void *bufferPointer = extractData(sizeUsed);
         
         if (bufferPointer != NULL)
@@ -123,7 +123,7 @@ public:
     }
 
 private:
-    void assignData(void *userAreaPointer, void *bufferAllocated, size_t sizeUsed)
+    void assignData(void *userAreaPointer, void *bufferAllocated, sizeint sizeUsed)
     {
         dIASSERT(m_userAreaPointer == NULL);
         dIASSERT(m_bufferAllocated == NULL);
@@ -134,7 +134,7 @@ private:
         m_sizeUsed = sizeUsed;
     }
 
-    void *extractData(size_t &out_sizeUsed)
+    void *extractData(sizeint &out_sizeUsed)
     {
         void *bufferPointer = m_bufferAllocated;
 
@@ -153,7 +153,7 @@ private:
 private:
     void *m_userAreaPointer;
     void *m_bufferAllocated;
-    size_t m_sizeUsed;
+    sizeint m_sizeUsed;
 };
 
 
@@ -208,8 +208,8 @@ union _const_type_cast_union
     operator const Type *() const { return m_pstTypedPointer; }
     const Type &operator *() const { return *m_pstTypedPointer; }
     const Type *operator ->() const { return m_pstTypedPointer; }
-    const Type &operator [](ptrdiff_t diElementIndex) const { return m_pstTypedPointer[diElementIndex]; }
-    const Type &operator [](size_t siElementIndex) const { return m_pstTypedPointer[siElementIndex]; }
+    const Type &operator [](diffint diElementIndex) const { return m_pstTypedPointer[diElementIndex]; }
+    const Type &operator [](sizeint siElementIndex) const { return m_pstTypedPointer[siElementIndex]; }
 
     const void 		*m_psvCharBuffer;
     const Type		*m_pstTypedPointer;
@@ -223,15 +223,15 @@ union _type_cast_union
     operator Type *() const { return m_pstTypedPointer; }
     Type &operator *() const { return *m_pstTypedPointer; }
     Type *operator ->() const { return m_pstTypedPointer; }
-    Type &operator [](ptrdiff_t diElementIndex) const { return m_pstTypedPointer[diElementIndex]; }
-    Type &operator [](size_t siElementIndex) const { return m_pstTypedPointer[siElementIndex]; }
+    Type &operator [](diffint diElementIndex) const { return m_pstTypedPointer[diElementIndex]; }
+    Type &operator [](sizeint siElementIndex) const { return m_pstTypedPointer[siElementIndex]; }
 
     void			*m_psvCharBuffer;
     Type			*m_pstTypedPointer;
 };
 
 
-template<size_t tsiTypeSize>
+template<sizeint tsiTypeSize>
 struct _sized_signed;
 
 template<>
@@ -265,7 +265,7 @@ struct _make_signed
 };
 
 
-template<size_t tsiTypeSize>
+template<sizeint tsiTypeSize>
 struct _sized_unsigned;
 
 template<>

+ 2 - 2
ode/src/convex.cpp

@@ -851,7 +851,7 @@ bool CheckEdgeIntersection(dxConvex& cvx1,dxConvex& cvx2, int flags,int& curc,
         e2[1]+=cvx1.final_posr->pos[1];
         e2[2]+=cvx1.final_posr->pos[2];
         const unsigned int* pPoly=cvx2.polygons;
-        for(size_t j=0;j<cvx2.planecount;++j)
+        for(sizeint j=0;j<cvx2.planecount;++j)
         {
             // Rotate
             dMultiply0_331(plane,cvx2.final_posr->R,cvx2.planes+(j*4));
@@ -870,7 +870,7 @@ bool CheckEdgeIntersection(dxConvex& cvx1,dxConvex& cvx2, int flags,int& curc,
                 if(IsPointInPolygon(target->pos,pPoly,plane,&cvx2,q))
                 {
                     target->depth = dInfinity;
-                    for(size_t k=0;k<cvx2.planecount;++k)
+                    for(sizeint k=0;k<cvx2.planecount;++k)
                     {
                         if(k==j) continue; // we're already at 0 depth on this plane
                         // Rotate

+ 6 - 6
ode/src/fastldltfactor.cpp

@@ -115,9 +115,9 @@ void ThreadedEquationSolverLDLT::doEstimateCooperativeFactoringLDLTResourceRequi
 
     FactorizationSolvingL1StripeMemoryEstimates solvingMemoryEstimates;
     FactorizationScalingAndFactorizingL1StripeMemoryEstimates scalingAndFactorizingEstimates;
-    size_t solvingMemoryRequired = estimateCooperativelySolvingL1Stripe_XMemoryRequirement(solvingTotalBlockCount, solvingMemoryEstimates);
-    size_t factorizingMemoryRequired = estimateCooperativelyScalingAndFactorizingL1Stripe_XMemoryRequirement(blockFactorizingMaximumThreads, scalingAndFactorizingEstimates);
-    size_t totalSizeRequired = solvingMemoryRequired + factorizingMemoryRequired;
+    sizeint solvingMemoryRequired = estimateCooperativelySolvingL1Stripe_XMemoryRequirement(solvingTotalBlockCount, solvingMemoryEstimates);
+    sizeint factorizingMemoryRequired = estimateCooperativelyScalingAndFactorizingL1Stripe_XMemoryRequirement(blockFactorizingMaximumThreads, scalingAndFactorizingEstimates);
+    sizeint totalSizeRequired = solvingMemoryRequired + factorizingMemoryRequired;
     const unsigned memoryAlignmentRequired = ALLOCATION_DEFAULT_ALIGNMENT;
 
     unsigned featureRequirement = dxResourceRequirementDescriptor::STOCK_CALLWAIT_REQUIRED;
@@ -147,9 +147,9 @@ void ThreadedEquationSolverLDLT::doCooperativelyFactorLDLTValidated(
 
     FactorizationSolvingL1StripeMemoryEstimates solvingMemoryEstimates;
     FactorizationScalingAndFactorizingL1StripeMemoryEstimates scalingAndFactorizingEstimates;
-    size_t solvingMemoryRequired = estimateCooperativelySolvingL1Stripe_XMemoryRequirement(solvingTotalBlockCount, solvingMemoryEstimates);
-    size_t factorizingMemoryRequired = estimateCooperativelyScalingAndFactorizingL1Stripe_XMemoryRequirement(blockFactorizingMaximumThreads, scalingAndFactorizingEstimates);
-    size_t totalSizeRequired = solvingMemoryRequired + factorizingMemoryRequired;
+    sizeint solvingMemoryRequired = estimateCooperativelySolvingL1Stripe_XMemoryRequirement(solvingTotalBlockCount, solvingMemoryEstimates);
+    sizeint factorizingMemoryRequired = estimateCooperativelyScalingAndFactorizingL1Stripe_XMemoryRequirement(blockFactorizingMaximumThreads, scalingAndFactorizingEstimates);
+    sizeint totalSizeRequired = solvingMemoryRequired + factorizingMemoryRequired;
     dIASSERT(totalSizeRequired <= resourceContainer->getMemoryBufferSize());
 
     void *bufferAllocated = resourceContainer->getMemoryBufferPointer();

+ 6 - 6
ode/src/fastldltfactor_impl.h

@@ -359,7 +359,7 @@ void scaleAndFactorizeL1Stripe_2(dReal *ARow, dReal *d, unsigned factorizationRo
     dReal dd = dRecip(Y11);
 
     ptrDElement[0 * d_stride] = dd;
-    dIASSERT(ptrDElement == d + (size_t)factorizationRow * d_stride);
+    dIASSERT(ptrDElement == d + (sizeint)factorizationRow * d_stride);
 
     /* factorize row 2 */
     dReal q2 = Y21 * dd;
@@ -385,7 +385,7 @@ void scaleAndFactorizeL1FirstRowStripe_2(dReal *ARow, dReal *d, unsigned rowSkip
     dReal dd = dRecip(Y11);
 
     ptrDElement[0 * d_stride] = dd;
-    dIASSERT(ptrDElement == d/* + (size_t)factorizationRow * d_stride*/);
+    dIASSERT(ptrDElement == d/* + (sizeint)factorizationRow * d_stride*/);
 
     /* factorize row 2 */
     dReal q2 = Y21 * dd;
@@ -423,7 +423,7 @@ void solveStripeL1_1(const dReal *L, dReal *B, unsigned rowCount, unsigned rowSk
 
         if (subsequentPass)
         {
-            ptrLElement = L + (size_t)blockStartRow * rowSkip;
+            ptrLElement = L + (sizeint)blockStartRow * rowSkip;
             ptrBElement = B;
 
             /* set the Z matrix to 0 */
@@ -504,7 +504,7 @@ void solveStripeL1_1(const dReal *L, dReal *B, unsigned rowCount, unsigned rowSk
         }
         else
         {
-            ptrLElement = L/* + (size_t)blockStartRow * rowSkip*/; dIASSERT(blockStartRow == 0);
+            ptrLElement = L/* + (sizeint)blockStartRow * rowSkip*/; dIASSERT(blockStartRow == 0);
             ptrBElement = B;
 
             /* set the Z matrix to 0 */
@@ -592,7 +592,7 @@ void scaleAndFactorizeL1Stripe_1(dReal *ARow, dReal *d, unsigned factorizationRo
     dReal Y11 = ptrAElement[0] - (Z11 + Z22);
 
     /* solve for diagonal 1 x 1 block at A(i,i) */
-    dIASSERT(ptrDElement == d + (size_t)factorizationRow * d_stride);
+    dIASSERT(ptrDElement == d + (sizeint)factorizationRow * d_stride);
     /* factorize 1 x 1 block Y, ptrDElement */
     /* factorize row 1 */
     ptrDElement[0 * d_stride] = dRecip(Y11);
@@ -1512,7 +1512,7 @@ void ThreadedEquationSolverLDLT::participateScalingAndFactorizingL1Stripe_X(dRea
         dReal dd = dRecip(Y11);
 
         ptrDElement[0 * d_stride] = dd;
-        dIASSERT(ptrDElement == d + (size_t)factorizationRow * d_stride);
+        dIASSERT(ptrDElement == d + (sizeint)factorizationRow * d_stride);
 
         if (a_rows >= 2)
         {

+ 2 - 2
ode/src/fastlsolve.cpp

@@ -107,7 +107,7 @@ void ThreadedEquationSolverLDLT::doEstimateCooperativeSolvingL1StraightResourceR
     unsigned simultaneousCallCount = 1 + (threadCountToUse - 1);
 
     SolvingL1StraightMemoryEstimates solvingMemoryEstimates;
-    size_t solvingMemoryRequired = estimateCooperativelySolvingL1StraightMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
+    sizeint solvingMemoryRequired = estimateCooperativelySolvingL1StraightMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
     const unsigned solvingAlignmentRequired = ALLOCATION_DEFAULT_ALIGNMENT;
 
     unsigned featureRequirement = dxResourceRequirementDescriptor::STOCK_CALLWAIT_REQUIRED;
@@ -136,7 +136,7 @@ void ThreadedEquationSolverLDLT::doCooperativelySolveL1StraightValidated(
     SolveL1StraightCellContext *cellContexts;
 
     SolvingL1StraightMemoryEstimates solvingMemoryEstimates;
-    size_t solvingMemoryRequired = estimateCooperativelySolvingL1StraightMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
+    sizeint solvingMemoryRequired = estimateCooperativelySolvingL1StraightMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
     dIASSERT(solvingMemoryRequired <= resourceContainer->getMemoryBufferSize());
 
     void *bufferAllocated = resourceContainer->getMemoryBufferPointer();

+ 25 - 25
ode/src/fastlsolve_impl.h

@@ -448,14 +448,14 @@ void solveL1Straight (const dReal *L, dReal *B, unsigned rowCount, unsigned rowS
 
 template<unsigned int block_step>
 /*static */
-size_t ThreadedEquationSolverLDLT::estimateCooperativelySolvingL1StraightMemoryRequirement(unsigned rowCount, SolvingL1StraightMemoryEstimates &ref_solvingMemoryEstimates)
+sizeint ThreadedEquationSolverLDLT::estimateCooperativelySolvingL1StraightMemoryRequirement(unsigned rowCount, SolvingL1StraightMemoryEstimates &ref_solvingMemoryEstimates)
 {
     unsigned blockCount = deriveSolvingL1StraightBlockCount(rowCount, block_step);
-    size_t descriptorSizeRequired = dEFFICIENT_SIZE(sizeof(cellindexint) * blockCount);
-    size_t contextSizeRequired = dEFFICIENT_SIZE(sizeof(SolveL1StraightCellContext) * (CCI__MAX + 1) * blockCount);
+    sizeint descriptorSizeRequired = dEFFICIENT_SIZE(sizeof(cellindexint) * blockCount);
+    sizeint contextSizeRequired = dEFFICIENT_SIZE(sizeof(SolveL1StraightCellContext) * (CCI__MAX + 1) * blockCount);
     ref_solvingMemoryEstimates.assignData(descriptorSizeRequired, contextSizeRequired);
 
-    size_t totalSizeRequired = descriptorSizeRequired + contextSizeRequired;
+    sizeint totalSizeRequired = descriptorSizeRequired + contextSizeRequired;
     return totalSizeRequired;
 }
 
@@ -631,8 +631,8 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
 
                 if (currentBlock != 0)
                 {
-                    ptrLElement = L + (size_t)(1 + currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
-                    ptrBElement = B + (size_t)(completedColumnBlock * block_step) * b_stride;
+                    ptrLElement = L + (sizeint)(1 + currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
+                    ptrBElement = B + (sizeint)(completedColumnBlock * block_step) * b_stride;
 
                     /* the inner loop that computes outer products and adds them to Z */
                     finalColumnBlock = dMACRO_MIN(currentBlock, completedBlocks);
@@ -852,8 +852,8 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                 }
                 else
                 {
-                    ptrLElement = L + (size_t)(1/* + currentBlock * block_step*/) * rowSkip/* + completedColumnBlock * block_step*/;
-                    ptrBElement = B/* + (size_t)(completedColumnBlock * block_step) * b_stride*/;
+                    ptrLElement = L + (sizeint)(1/* + currentBlock * block_step*/) * rowSkip/* + completedColumnBlock * block_step*/;
+                    ptrBElement = B/* + (sizeint)(completedColumnBlock * block_step) * b_stride*/;
                     dIASSERT(completedColumnBlock == 0);
 
                     rowEndReached = true;
@@ -867,8 +867,8 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                 {
                     dReal tempZ[dMACRO_MAX(block_step - 1U, 1U)] = { REAL(0.0), };
 
-                    ptrLElement = L + (size_t)(/*1 + */currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
-                    ptrBElement = B + (size_t)(completedColumnBlock * block_step) * b_stride;
+                    ptrLElement = L + (sizeint)(/*1 + */currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
+                    ptrBElement = B + (sizeint)(completedColumnBlock * block_step) * b_stride;
 
                     /* the inner loop that computes outer products and adds them to Z */
                     finalColumnBlock = dMACRO_MIN(currentBlock, completedBlocks);
@@ -982,7 +982,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                                     // Note, that ff there is just one partial row, it does not matter that 
                                     // the LElement will remain pointing at the first row, 
                                     // since the former is not going to be used in that case.
-                                    ptrLElement -= /*(size_t)*/rowSkip/* * (loopX1RowCount - 2)*/; dIASSERT(loopX1RowCount == 3);
+                                    ptrLElement -= /*(sizeint)*/rowSkip/* * (loopX1RowCount - 2)*/; dIASSERT(loopX1RowCount == 3);
                                 }
                                 dSASSERT(block_step == 4);
 
@@ -1003,7 +1003,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                             partialRow = 0;
 
                             // Correct the LElement pointer to continue at the first partial row
-                            ptrLElement -= (size_t)rowSkip * (loopX1RowCount - 1);
+                            ptrLElement -= (sizeint)rowSkip * (loopX1RowCount - 1);
 
                             // ...continue if so.
                             columnCompletedSoFar = finalColumnBlock;
@@ -1012,15 +1012,15 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                         else
                         {
                             ptrLElement += rowSkip - (finalColumnBlock - columnCompletedSoFar) * block_step;
-                            ptrBElement -= (size_t)((finalColumnBlock - columnCompletedSoFar) * block_step) * b_stride;
+                            ptrBElement -= (sizeint)((finalColumnBlock - columnCompletedSoFar) * block_step) * b_stride;
                         }
                         /* end of loop by individual rows */
                     }
                 }
                 else
                 {
-                    ptrLElement = L + (size_t)(1/* + currentBlock * block_step*/) * rowSkip/* + completedColumnBlock * block_step*/;
-                    ptrBElement = B/* + (size_t)(completedColumnBlock * block_step) * b_stride*/;
+                    ptrLElement = L + (sizeint)(1/* + currentBlock * block_step*/) * rowSkip/* + completedColumnBlock * block_step*/;
+                    ptrBElement = B/* + (sizeint)(completedColumnBlock * block_step) * b_stride*/;
                     dIASSERT(completedColumnBlock == 0);
 
                     rowEndReached = true;
@@ -1118,7 +1118,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                 if (!CooperativeAtomics::AtomicCompareExchangeCellindexint(&blockProgressDescriptors[currentBlock], oldDescriptor, newDescriptor))
                 {
                     // Adjust the ptrBElement to point to the result area...
-                    ptrBElement = B + (size_t)(currentBlock * block_step) * b_stride;
+                    ptrBElement = B + (sizeint)(currentBlock * block_step) * b_stride;
                     // ...and go on handling the case
                     handleComputationTakenOver = true;
                 }
@@ -1163,8 +1163,8 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                 {
                     partialBlock = false;
 
-                    ptrLElement = L + (size_t)(1 + currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
-                    ptrBElement = B + (size_t)(completedColumnBlock * block_step) * b_stride;
+                    ptrLElement = L + (sizeint)(1 + currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
+                    ptrBElement = B + (sizeint)(completedColumnBlock * block_step) * b_stride;
 
                     /* the inner loop that computes outer products and adds them to Z */
                     unsigned finalColumnBlock = currentBlock;
@@ -1282,8 +1282,8 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
 
                     dReal tempZ[dMACRO_MAX(block_step - 1U, 1U)] = { REAL(0.0), };
 
-                    ptrLElement = L + (size_t)(/*1 + */currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
-                    ptrBElement = B + (size_t)(completedColumnBlock * block_step) * b_stride;
+                    ptrLElement = L + (sizeint)(/*1 + */currentBlock * block_step) * rowSkip + completedColumnBlock * block_step;
+                    ptrBElement = B + (sizeint)(completedColumnBlock * block_step) * b_stride;
 
                     /* the inner loop that computes outer products and adds them to Z */
                     unsigned finalColumnBlock = currentBlock;
@@ -1383,7 +1383,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                                     // Note, that if there is just one partial row, it does not matter that 
                                     // the LElement will remain pointing at the first row, 
                                     // since the former is not going to be used in that case.
-                                    ptrLElement -= /*(size_t)*/rowSkip/* * (loopX1RowCount - 2)*/; dIASSERT(loopX1RowCount == 3);
+                                    ptrLElement -= /*(sizeint)*/rowSkip/* * (loopX1RowCount - 2)*/; dIASSERT(loopX1RowCount == 3);
                                 }
                             }
                             dSASSERT(block_step == 4);
@@ -1392,7 +1392,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                         }
 
                         /* advance pointers */
-                        ptrLElement -= (size_t)rowSkip * (loopX1RowCount - 1);
+                        ptrLElement -= (sizeint)rowSkip * (loopX1RowCount - 1);
                         /* end of inner loop */
                     }
                 }
@@ -1412,8 +1412,8 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                 partialBlock = rowCount < block_step;
 
                 /* assign the pointers appropriately and go on computing the results */
-                ptrLElement = L + (size_t)(1/* + currentBlock * block_step*/) * rowSkip/* + completedColumnBlock * block_step*/;
-                ptrBElement = B/* + (size_t)(completedColumnBlock * block_step) * b_stride*/;
+                ptrLElement = L + (sizeint)(1/* + currentBlock * block_step*/) * rowSkip/* + completedColumnBlock * block_step*/;
+                ptrBElement = B/* + (sizeint)(completedColumnBlock * block_step) * b_stride*/;
             }
 
             if (!skipToHandlingSubsequentRows)
@@ -1499,7 +1499,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Straight(const dReal *L, dR
                         const SolveL1StraightCellContext &resultContext = buildResultContextRef(cellContexts, currentBlock, blockCount);
                         resultContext.loadPrecalculatedZs(Y);
 
-                        ptrBElement = B + (size_t)(currentBlock * block_step) * b_stride;
+                        ptrBElement = B + (sizeint)(currentBlock * block_step) * b_stride;
                     }
 
                     goAssigningTheResult = true;

+ 2 - 2
ode/src/fastltsolve.cpp

@@ -107,7 +107,7 @@ void ThreadedEquationSolverLDLT::doEstimateCooperativeSolvingL1TransposedResourc
     unsigned simultaneousCallCount = 1 + (threadCountToUse - 1);
 
     SolvingL1TransposedMemoryEstimates solvingMemoryEstimates;
-    size_t solvingMemoryRequired = estimateCooperativelySolvingL1TransposedMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
+    sizeint solvingMemoryRequired = estimateCooperativelySolvingL1TransposedMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
     const unsigned solvingAlignmentRequired = ALLOCATION_DEFAULT_ALIGNMENT;
 
     unsigned featureRequirement = dxResourceRequirementDescriptor::STOCK_CALLWAIT_REQUIRED;
@@ -136,7 +136,7 @@ void ThreadedEquationSolverLDLT::doCooperativelySolveL1TransposedValidated(
     SolveL1TransposedCellContext *cellContexts;
 
     SolvingL1TransposedMemoryEstimates solvingMemoryEstimates;
-    size_t solvingMemoryRequired = estimateCooperativelySolvingL1TransposedMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
+    sizeint solvingMemoryRequired = estimateCooperativelySolvingL1TransposedMemoryRequirement<blockStep>(rowCount, solvingMemoryEstimates);
     dIASSERT(solvingMemoryRequired <= resourceContainer->getMemoryBufferSize());
 
     void *bufferAllocated = resourceContainer->getMemoryBufferPointer();

+ 15 - 15
ode/src/fastltsolve_impl.h

@@ -46,8 +46,8 @@ void solveL1Transposed(const dReal *L, dReal *B, unsigned rowCount, unsigned row
     dIASSERT(rowCount != 0);
 
     /* special handling for L and B because we're solving L1 *transpose* */
-    const dReal *lastLElement = L + (size_t)(rowCount - 1) * (rowSkip + 1);
-    dReal *lastBElement = B + (size_t)(rowCount - 1) * b_stride;
+    const dReal *lastLElement = L + (sizeint)(rowCount - 1) * (rowSkip + 1);
+    dReal *lastBElement = B + (sizeint)(rowCount - 1) * b_stride;
 
     /* compute rows at end that are not a multiple of block size */
     const unsigned loopX1RowCount = rowCount % 4;
@@ -393,14 +393,14 @@ void solveL1Transposed(const dReal *L, dReal *B, unsigned rowCount, unsigned row
 
 template<unsigned int block_step>
 /*static */
-size_t ThreadedEquationSolverLDLT::estimateCooperativelySolvingL1TransposedMemoryRequirement(unsigned rowCount, SolvingL1TransposedMemoryEstimates &ref_solvingMemoryEstimates)
+sizeint ThreadedEquationSolverLDLT::estimateCooperativelySolvingL1TransposedMemoryRequirement(unsigned rowCount, SolvingL1TransposedMemoryEstimates &ref_solvingMemoryEstimates)
 {
     unsigned blockCount = deriveSolvingL1TransposedBlockCount(rowCount, block_step);
-    size_t descriptorSizeRequired = dEFFICIENT_SIZE(sizeof(cellindexint) * blockCount);
-    size_t contextSizeRequired = dEFFICIENT_SIZE(sizeof(SolveL1TransposedCellContext) * (CCI__MAX + 1) * blockCount);
+    sizeint descriptorSizeRequired = dEFFICIENT_SIZE(sizeof(cellindexint) * blockCount);
+    sizeint contextSizeRequired = dEFFICIENT_SIZE(sizeof(SolveL1TransposedCellContext) * (CCI__MAX + 1) * blockCount);
     ref_solvingMemoryEstimates.assignData(descriptorSizeRequired, contextSizeRequired);
 
-    size_t totalSizeRequired = descriptorSizeRequired + contextSizeRequired;
+    sizeint totalSizeRequired = descriptorSizeRequired + contextSizeRequired;
     return totalSizeRequired;
 }
 
@@ -427,13 +427,13 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Transposed(const dReal *L,
     const unsigned loopX1RowCount = rowCount % block_step;
 
     /* special handling for L and B because we're solving L1 *transpose* */
-    const dReal *lastLElement = L + (rowCount - 1) * ((size_t)rowSkip + 1);
-    dReal *lastBElement = B + (rowCount - 1) * (size_t)b_stride;
+    const dReal *lastLElement = L + (rowCount - 1) * ((sizeint)rowSkip + 1);
+    dReal *lastBElement = B + (rowCount - 1) * (sizeint)b_stride;
 
     /* elements adjusted as if the last block was full block_step elements */
     unsigned x1AdjustmentElements = (block_step - loopX1RowCount) % block_step;
     const dReal *columnAdjustedLastLElement = lastLElement + x1AdjustmentElements;
-    const dReal *fullyAdjustedLastLElement = columnAdjustedLastLElement + (size_t)rowSkip * x1AdjustmentElements;
+    const dReal *fullyAdjustedLastLElement = columnAdjustedLastLElement + (sizeint)rowSkip * x1AdjustmentElements;
     dReal *adjustedLastBElement = lastBElement + b_stride * x1AdjustmentElements;
 
     BlockProcessingState blockProcessingState = BPS_NO_BLOCKS_PROCESSED;
@@ -586,10 +586,10 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Transposed(const dReal *L,
                 partialBlock = false;
 
                 ptrLElement = completedRowBlock != 0 
-                    ? fullyAdjustedLastLElement - currentBlock * block_step - (size_t)(completedRowBlock * block_step) * rowSkip 
+                    ? fullyAdjustedLastLElement - currentBlock * block_step - (sizeint)(completedRowBlock * block_step) * rowSkip 
                     : columnAdjustedLastLElement - currentBlock * block_step;
                 ptrBElement = completedRowBlock != 0 
-                    ? adjustedLastBElement - (size_t)(completedRowBlock * block_step) * b_stride 
+                    ? adjustedLastBElement - (sizeint)(completedRowBlock * block_step) * b_stride 
                     : lastBElement;
 
                 finalRowBlock = dMACRO_MIN(currentBlock, completedBlocks);
@@ -1002,7 +1002,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Transposed(const dReal *L,
                 if (!CooperativeAtomics::AtomicCompareExchangeCellindexint(&blockProgressDescriptors[currentBlock], oldDescriptor, newDescriptor))
                 {
                     // Adjust the ptrBElement to point to the result area...
-                    ptrBElement = adjustedLastBElement - (size_t)(currentBlock * block_step) * b_stride;
+                    ptrBElement = adjustedLastBElement - (sizeint)(currentBlock * block_step) * b_stride;
                     dIASSERT(currentBlock != 0 || adjustedLastBElement == lastBElement);
                     // ...and go on handling the case
                     handleComputationTakenOver = true;
@@ -1046,10 +1046,10 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Transposed(const dReal *L,
                 partialBlock = false;
 
                 ptrLElement = completedRowBlock != 0 
-                    ? fullyAdjustedLastLElement - currentBlock * block_step - (size_t)(completedRowBlock * block_step) * rowSkip
+                    ? fullyAdjustedLastLElement - currentBlock * block_step - (sizeint)(completedRowBlock * block_step) * rowSkip
                     : columnAdjustedLastLElement - currentBlock * block_step;
                 ptrBElement = completedRowBlock != 0 
-                    ? adjustedLastBElement - (size_t)(completedRowBlock * block_step) * b_stride 
+                    ? adjustedLastBElement - (sizeint)(completedRowBlock * block_step) * b_stride 
                     : lastBElement;
 
                 unsigned finalRowBlock = currentBlock/*std::min(currentBlock, completedBlocks)*/;
@@ -1329,7 +1329,7 @@ void ThreadedEquationSolverLDLT::participateSolvingL1Transposed(const dReal *L,
                         const SolveL1TransposedCellContext &resultContext = buildResultContextRef(cellContexts, currentBlock, blockCount);
                         resultContext.loadPrecalculatedZs(Y);
 
-                        ptrBElement = currentBlock != 0 ? adjustedLastBElement - (size_t)(currentBlock * block_step) * b_stride : lastBElement;
+                        ptrBElement = currentBlock != 0 ? adjustedLastBElement - (sizeint)(currentBlock * block_step) * b_stride : lastBElement;
                     }
 
                     goAssigningTheResult = true;

+ 1 - 1
ode/src/fastvecscale.cpp

@@ -98,7 +98,7 @@ void ThreadedEquationSolverLDLT::doEstimateCooperativeScalingVectorResourceRequi
 {
     unsigned simultaneousCallCount = 1 + (allowedThreadCount - 1);
 
-    size_t scalingMemoryRequired = 0;
+    sizeint scalingMemoryRequired = 0;
     const unsigned scalingAlignmentRequired = 0;
 
     unsigned featureRequirement = dxResourceRequirementDescriptor::STOCK_CALLWAIT_REQUIRED;

+ 7 - 7
ode/src/fastvecscale_impl.h

@@ -39,7 +39,7 @@ void scaleLargeVector(dReal *aStart, const dReal *dStart, unsigned elementCount)
 
     dReal *ptrA = aStart;
     const dReal *ptrD = dStart;
-    const dReal *const dStepsEnd = dStart + (size_t)(elementCount & ~(step - 1)) * d_stride;
+    const dReal *const dStepsEnd = dStart + (sizeint)(elementCount & ~(step - 1)) * d_stride;
     for (; ptrD != dStepsEnd; ptrA += step * a_stride, ptrD += step * d_stride) 
     {
         dReal a0 = ptrA[0], a1 = ptrA[1 * a_stride], a2 = ptrA[2 * a_stride], a3 = ptrA[3 * a_stride];
@@ -100,11 +100,11 @@ void ThreadedEquationSolverLDLT::participateScalingVector(dReal *ptrAStart, cons
     unsigned blockIndex;
     while ((blockIndex = ThrsafeIncrementIntUpToLimit(&refBlockCompletionProgress, completeBlockCount)) != completeBlockCount)
     {
-        dReal *ptrAElement = ptrAStart + (size_t)(blockIndex * block_step) * a_stride;
-        const dReal *ptrDElement = ptrDStart + (size_t)(blockIndex * block_step) * d_stride;
+        dReal *ptrAElement = ptrAStart + (sizeint)(blockIndex * block_step) * a_stride;
+        const dReal *ptrDElement = ptrDStart + (sizeint)(blockIndex * block_step) * d_stride;
         const dReal *const ptrDBlockEnd = ptrDElement + block_step * d_stride;
-        dSASSERT((size_t)block_step * a_stride < UINT_MAX);
-        dSASSERT((size_t)block_step * d_stride < UINT_MAX);
+        dSASSERT((sizeint)block_step * a_stride < UINT_MAX);
+        dSASSERT((sizeint)block_step * d_stride < UINT_MAX);
 
         for (; ptrDElement != ptrDBlockEnd; ptrAElement += wrapSize * a_stride, ptrDElement += wrapSize * d_stride)
         {
@@ -121,8 +121,8 @@ void ThreadedEquationSolverLDLT::participateScalingVector(dReal *ptrAStart, cons
 
     if (trailingBlockElements != 0 && (blockIndex = ThrsafeIncrementIntUpToLimit(&refBlockCompletionProgress, completeBlockCount + 1)) != completeBlockCount + 1)
     {
-        dReal *ptrAElement = ptrAStart + (size_t)(completeBlockCount * block_step) * a_stride;
-        const dReal *ptrDElement = ptrDStart + (size_t)(completeBlockCount * block_step) * d_stride;
+        dReal *ptrAElement = ptrAStart + (sizeint)(completeBlockCount * block_step) * a_stride;
+        const dReal *ptrDElement = ptrDStart + (sizeint)(completeBlockCount * block_step) * d_stride;
         const dReal *const ptrDBlockEnd = ptrDElement + (trailingBlockElements & ~(wrapSize - 1)) * d_stride;
 
         for (; ptrDElement != ptrDBlockEnd; ptrAElement += wrapSize * a_stride, ptrDElement += wrapSize * d_stride)

+ 19 - 19
ode/src/heightfield.cpp

@@ -631,9 +631,9 @@ dxHeightfield::~dxHeightfield()
     resetHeightBuffer();
 }
 
-void dxHeightfield::allocateTriangleBuffer(size_t numTri)
+void dxHeightfield::allocateTriangleBuffer(sizeint numTri)
 {
-    size_t alignedNumTri = AlignBufferSize(numTri, TEMP_TRIANGLE_BUFFER_ELEMENT_COUNT_ALIGNMENT);
+    sizeint alignedNumTri = AlignBufferSize(numTri, TEMP_TRIANGLE_BUFFER_ELEMENT_COUNT_ALIGNMENT);
     tempTriangleBufferSize = alignedNumTri;
     tempTriangleBuffer = new HeightFieldTriangle[alignedNumTri];
 }
@@ -643,15 +643,15 @@ void dxHeightfield::resetTriangleBuffer()
     delete[] tempTriangleBuffer;
 }
 
-void dxHeightfield::allocatePlaneBuffer(size_t numTri)
+void dxHeightfield::allocatePlaneBuffer(sizeint numTri)
 {
-    size_t alignedNumTri = AlignBufferSize(numTri, TEMP_PLANE_BUFFER_ELEMENT_COUNT_ALIGNMENT);
+    sizeint alignedNumTri = AlignBufferSize(numTri, TEMP_PLANE_BUFFER_ELEMENT_COUNT_ALIGNMENT);
     tempPlaneBufferSize = alignedNumTri;
     tempPlaneBuffer = new HeightFieldPlane *[alignedNumTri];
     tempPlaneInstances = new HeightFieldPlane[alignedNumTri];
 
     HeightFieldPlane *ptrPlaneMatrix = tempPlaneInstances;
-    for (size_t indexTri = 0; indexTri != alignedNumTri; indexTri++)
+    for (sizeint indexTri = 0; indexTri != alignedNumTri; indexTri++)
     {
         tempPlaneBuffer[indexTri] = ptrPlaneMatrix;
         ptrPlaneMatrix += 1;
@@ -664,18 +664,18 @@ void dxHeightfield::resetPlaneBuffer()
     delete[] tempPlaneBuffer;
 }
 
-void dxHeightfield::allocateHeightBuffer(size_t numX, size_t numZ)
+void dxHeightfield::allocateHeightBuffer(sizeint numX, sizeint numZ)
 {
-    size_t alignedNumX = AlignBufferSize(numX, TEMP_HEIGHT_BUFFER_ELEMENT_COUNT_ALIGNMENT_X);
-    size_t alignedNumZ = AlignBufferSize(numZ, TEMP_HEIGHT_BUFFER_ELEMENT_COUNT_ALIGNMENT_Z);
+    sizeint alignedNumX = AlignBufferSize(numX, TEMP_HEIGHT_BUFFER_ELEMENT_COUNT_ALIGNMENT_X);
+    sizeint alignedNumZ = AlignBufferSize(numZ, TEMP_HEIGHT_BUFFER_ELEMENT_COUNT_ALIGNMENT_Z);
     tempHeightBufferSizeX = alignedNumX;
     tempHeightBufferSizeZ = alignedNumZ;
     tempHeightBuffer = new HeightFieldVertex *[alignedNumX];
-    size_t numCells = alignedNumX * alignedNumZ;
+    sizeint numCells = alignedNumX * alignedNumZ;
     tempHeightInstances = new HeightFieldVertex [numCells];
 
     HeightFieldVertex *ptrHeightMatrix = tempHeightInstances;
-    for (size_t indexX = 0; indexX != alignedNumX; indexX++)
+    for (sizeint indexX = 0; indexX != alignedNumX; indexX++)
     {
         tempHeightBuffer[indexX] = ptrHeightMatrix;
         ptrHeightMatrix += alignedNumZ;
@@ -930,13 +930,13 @@ static inline bool DescendingPlaneSort(const HeightFieldPlane * const A, const H
     return ((A->maxAAAB - B->maxAAAB) > dEpsilon);
 }
 
-void dxHeightfield::sortPlanes(const size_t numPlanes)
+void dxHeightfield::sortPlanes(const sizeint numPlanes)
 {
     bool has_swapped = true;
     do
     {
         has_swapped = false;//reset flag
-        for (size_t i = 0; i < numPlanes - 1; i++)
+        for (sizeint i = 0; i < numPlanes - 1; i++)
         {
             //if they are in the wrong order
             if (DescendingPlaneSort(tempPlaneBuffer[i], tempPlaneBuffer[i + 1]))
@@ -1495,13 +1495,13 @@ int dxHeightfield::dCollideHeightfieldZone( const int minX, const int maxX, cons
             // find collision and compute contact points
             bool didCollide = false;
             const int numPlaneContacts = geomNPlaneCollider (o2, sliding_plane, planeTestFlags, PlaneContact, sizeof(dContactGeom));
-            const size_t planeTriListSize = itPlane->trianglelistCurrentSize;
+            const sizeint planeTriListSize = itPlane->trianglelistCurrentSize;
             for (i = 0; i < numPlaneContacts; i++)
             {
                 dContactGeom *planeCurrContact = PlaneContact + i;
                 // Check if contact point found in plane is inside Triangle.
                 const dVector3 &pCPos = planeCurrContact->pos;
-                for (size_t b = 0; planeTriListSize > b; b++)
+                for (sizeint b = 0; planeTriListSize > b; b++)
                 {  
                     if (m_p_data->IsOnHeightfield2 (itPlane->trianglelist[b]->vertices[0], 
                         pCPos, 
@@ -1532,7 +1532,7 @@ int dxHeightfield::dCollideHeightfieldZone( const int minX, const int maxX, cons
                 planeTestFlags = (flags & ~NUMC_MASK) | numMaxContactsPerPlane;
                 dIASSERT((HEIGHTFIELDMAXCONTACTPERCELL & ~NUMC_MASK) == 0);
 #endif        
-                for (size_t b = 0; planeTriListSize > b; b++)
+                for (sizeint b = 0; planeTriListSize > b; b++)
                 {                      
                     // flag Triangles Vertices as collided 
                     // to prevent any collision test of those
@@ -1544,7 +1544,7 @@ int dxHeightfield::dCollideHeightfieldZone( const int minX, const int maxX, cons
             {
                 // flag triangle as not collided so that Vertices or Edge
                 // of that triangles will be checked.
-                for (size_t b = 0; planeTriListSize > b; b++)
+                for (sizeint b = 0; planeTriListSize > b; b++)
                 { 
                     itPlane->trianglelist[b]->state = false;
                 }
@@ -1573,7 +1573,7 @@ int dxHeightfield::dCollideHeightfieldZone( const int minX, const int maxX, cons
             if (itTriangle->state == true)
                 continue;// plane triangle did already collide.
 
-            for (size_t i = 0; i < 3; i++)
+            for (sizeint i = 0; i < 3; i++)
             {
                 HeightFieldVertex *vertex = itTriangle->vertices[i];
                 if (vertex->state == true)
@@ -1645,9 +1645,9 @@ int dxHeightfield::dCollideHeightfieldZone( const int minX, const int maxX, cons
             if (itTriangle->state == true)
                 continue;// plane did already collide.
 
-            for (size_t m = 0; m < 3; m++)
+            for (sizeint m = 0; m < 3; m++)
             {
-                const size_t next = (m + 1) % 3;
+                const sizeint next = (m + 1) % 3;
                 HeightFieldVertex *vertex0 = itTriangle->vertices[m];
                 HeightFieldVertex *vertex1 = itTriangle->vertices[next];
 

+ 14 - 14
ode/src/heightfield.h

@@ -151,11 +151,11 @@ public:
 
     inline void setMinMax()
     {
-        const size_t asize = trianglelistCurrentSize;
+        const sizeint asize = trianglelistCurrentSize;
         if (asize > 0)
         {  
             maxAAAB = trianglelist[0]->maxAAAB;
-            for (size_t k = 1; asize > k; k++)
+            for (sizeint k = 1; asize > k; k++)
             {   
                 if (trianglelist[k]->maxAAAB >  maxAAAB)
                     maxAAAB = trianglelist[k]->maxAAAB;
@@ -163,7 +163,7 @@ public:
         }
     };
 
-    void resetTriangleListSize(const size_t newSize)
+    void resetTriangleListSize(const sizeint newSize)
     {
         if (trianglelistReservedSize < newSize)
         {
@@ -182,8 +182,8 @@ public:
     }
 
     HeightFieldTriangle **trianglelist;
-    size_t              trianglelistReservedSize;
-    size_t              trianglelistCurrentSize;
+    sizeint             trianglelistReservedSize;
+    sizeint             trianglelistCurrentSize;
 
     dReal   maxAAAB;
     dReal   planeDef[4];
@@ -215,28 +215,28 @@ struct dxHeightfield : public dxGeom
         TEMP_TRIANGLE_BUFFER_ELEMENT_COUNT_ALIGNMENT = 1 // Triangles are easy to reallocate and hard to predict
     };
 
-    static inline size_t AlignBufferSize(size_t value, size_t alignment) { dIASSERT((alignment & (alignment - 1)) == 0); return (value + (alignment - 1)) & ~(alignment - 1); }
+    static inline sizeint AlignBufferSize(sizeint value, sizeint alignment) { dIASSERT((alignment & (alignment - 1)) == 0); return (value + (alignment - 1)) & ~(alignment - 1); }
 
-    void  allocateTriangleBuffer(size_t numTri);
+    void  allocateTriangleBuffer(sizeint numTri);
     void  resetTriangleBuffer();
-    void  allocatePlaneBuffer(size_t numTri);
+    void  allocatePlaneBuffer(sizeint numTri);
     void  resetPlaneBuffer();
-    void  allocateHeightBuffer(size_t numX, size_t numZ);
+    void  allocateHeightBuffer(sizeint numX, sizeint numZ);
     void  resetHeightBuffer();
 
-    void  sortPlanes(const size_t numPlanes);
+    void  sortPlanes(const sizeint numPlanes);
 
     HeightFieldPlane    **tempPlaneBuffer;
     HeightFieldPlane    *tempPlaneInstances;
-    size_t              tempPlaneBufferSize;
+    sizeint             tempPlaneBufferSize;
 
     HeightFieldTriangle *tempTriangleBuffer;
-    size_t              tempTriangleBufferSize;
+    sizeint             tempTriangleBufferSize;
 
     HeightFieldVertex   **tempHeightBuffer;
     HeightFieldVertex   *tempHeightInstances;
-    size_t              tempHeightBufferSizeX;
-    size_t              tempHeightBufferSizeZ;
+    sizeint             tempHeightBufferSizeX;
+    sizeint             tempHeightBufferSizeZ;
 
 };
 

+ 2 - 2
ode/src/joints/amotor.cpp

@@ -325,7 +325,7 @@ void dxJointAMotor::getInfo2(dReal worldFPS, dReal /*worldERP*/,
         axptr[dSA_X] = &ax1_cross_ax2;
     }
 
-    size_t rowTotalSkip = 0, pairTotalSkip = 0;
+    sizeint rowTotalSkip = 0, pairTotalSkip = 0;
     
     const unsigned num = m_num;
     for (unsigned i = 0; i != num; ++i) 
@@ -345,7 +345,7 @@ dJointType dxJointAMotor::type() const
 }
 
 /*virtual */
-size_t dxJointAMotor::size() const
+sizeint dxJointAMotor::size() const
 {
     return sizeof(*this);
 }

+ 1 - 1
ode/src/joints/amotor.h

@@ -44,7 +44,7 @@ public:
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex);
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
 public:
     void setOperationMode(int mode);

+ 1 - 1
ode/src/joints/ball.cpp

@@ -168,7 +168,7 @@ dxJointBall::type() const
     return dJointTypeBall;
 }
 
-size_t
+sizeint
 dxJointBall::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/ball.h

@@ -44,7 +44,7 @@ struct dxJointBall : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 };

+ 1 - 1
ode/src/joints/contact.cpp

@@ -313,7 +313,7 @@ dxJointContact::type() const
 }
 
 
-size_t
+sizeint
 dxJointContact::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/contact.h

@@ -40,7 +40,7 @@ struct dxJointContact : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex);
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 };
 
 

+ 1 - 1
ode/src/joints/dball.cpp

@@ -298,7 +298,7 @@ dxJointDBall::type() const
     return dJointTypeDBall;
 }
 
-size_t
+sizeint
 dxJointDBall::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/dball.h

@@ -48,7 +48,7 @@ struct dxJointDBall : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 };

+ 1 - 1
ode/src/joints/dhinge.cpp

@@ -213,7 +213,7 @@ dxJointDHinge::type() const
     return dJointTypeDHinge;
 }
 
-size_t
+sizeint
 dxJointDHinge::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/dhinge.h

@@ -38,7 +38,7 @@ struct dxJointDHinge : public dxJointDBall
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
 };
 

+ 1 - 1
ode/src/joints/fixed.cpp

@@ -188,7 +188,7 @@ dxJointFixed::type() const
 }
 
 
-size_t
+sizeint
 dxJointFixed::size() const
 {
     return sizeof ( *this );

+ 1 - 1
ode/src/joints/fixed.h

@@ -45,7 +45,7 @@ struct dxJointFixed : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     void computeInitialRelativeRotation();
 };

+ 1 - 1
ode/src/joints/hinge.cpp

@@ -351,7 +351,7 @@ dxJointHinge::type() const
 
 
 
-size_t
+sizeint
 dxJointHinge::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/hinge.h

@@ -45,7 +45,7 @@ struct dxJointHinge : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 

+ 1 - 1
ode/src/joints/hinge2.cpp

@@ -510,7 +510,7 @@ dxJointHinge2::type() const
 }
 
 
-size_t
+sizeint
 dxJointHinge2::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/hinge2.h

@@ -61,7 +61,7 @@ struct dxJointHinge2 : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 };

+ 2 - 2
ode/src/joints/joint.cpp

@@ -78,9 +78,9 @@ bool dxJoint::isEnabled() const
 }
 
 
-size_t dxJointGroup::exportJoints(dxJoint **jlist)
+sizeint dxJointGroup::exportJoints(dxJoint **jlist)
 {
-    size_t i=0;
+    sizeint i=0;
     dxJoint *j = (dxJoint*) m_stack.rewind();
     while (j != NULL) {
         jlist[i++] = j;

+ 5 - 5
ode/src/joints/joint.h

@@ -233,7 +233,7 @@ struct dxJoint : public dObject
     // See comments at definition of SureMaxInfo for details.
     virtual void getSureMaxInfo( SureMaxInfo* info ) = 0;
     virtual dJointType type() const = 0;
-    virtual size_t size() const = 0;
+    virtual sizeint size() const = 0;
 
     /// Set values which are relative with respect to bodies.
     /// Each dxJoint should redefine it if needed.
@@ -264,16 +264,16 @@ struct dxJointGroup : public dBase
         return j;
     }
 
-    size_t getJointCount() const { return m_num; }
-    size_t exportJoints(dxJoint **jlist);
+    sizeint getJointCount() const { return m_num; }
+    sizeint exportJoints(dxJoint **jlist);
 
     void *beginEnum() { return m_stack.rewind(); }
-    void *continueEnum(size_t num_bytes) { return m_stack.next(num_bytes); }
+    void *continueEnum(sizeint num_bytes) { return m_stack.next(num_bytes); }
 
     void freeAll();
 
 private:
-    size_t m_num;        // number of joints on the stack
+    sizeint m_num;        // number of joints on the stack
     dObStack m_stack; // a stack of (possibly differently sized) dxJoint objects.
 };
 

+ 1 - 1
ode/src/joints/lmotor.cpp

@@ -206,7 +206,7 @@ dxJointLMotor::type() const
 }
 
 
-size_t
+sizeint
 dxJointLMotor::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/lmotor.h

@@ -43,7 +43,7 @@ struct dxJointLMotor : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 };
 
 

+ 1 - 1
ode/src/joints/null.cpp

@@ -65,7 +65,7 @@ dxJointNull::type() const
     return dJointTypeNull;
 }
 
-size_t
+sizeint
 dxJointNull::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/null.h

@@ -39,7 +39,7 @@ struct dxJointNull : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 };
 
 #endif

+ 1 - 1
ode/src/joints/piston.cpp

@@ -684,7 +684,7 @@ dxJointPiston::type() const
 }
 
 
-size_t
+sizeint
 dxJointPiston::size() const
 {
     return sizeof ( *this );

+ 1 - 1
ode/src/joints/piston.h

@@ -99,7 +99,7 @@ struct dxJointPiston : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 

+ 1 - 1
ode/src/joints/plane2d.cpp

@@ -155,7 +155,7 @@ dxJointPlane2D::type() const
 }
 
 
-size_t
+sizeint
 dxJointPlane2D::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/plane2d.h

@@ -46,7 +46,7 @@ struct dxJointPlane2D : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 };
 
 

+ 1 - 1
ode/src/joints/pr.cpp

@@ -583,7 +583,7 @@ dxJointPR::type() const
     return dJointTypePR;
 }
 
-size_t
+sizeint
 dxJointPR::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/pr.h

@@ -89,7 +89,7 @@ struct dxJointPR : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 };

+ 1 - 1
ode/src/joints/pu.cpp

@@ -718,7 +718,7 @@ dxJointPU::type() const
 }
 
 
-size_t
+sizeint
 dxJointPU::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/pu.h

@@ -77,7 +77,7 @@ struct dxJointPU : public dxJointUniversal
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
 
     virtual void setRelativeValues();

+ 1 - 1
ode/src/joints/slider.cpp

@@ -361,7 +361,7 @@ dxJointSlider::type() const
 }
 
 
-size_t
+sizeint
 dxJointSlider::size() const
 {
     return sizeof ( *this );

+ 1 - 1
ode/src/joints/slider.h

@@ -45,7 +45,7 @@ struct dxJointSlider : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 

+ 1 - 1
ode/src/joints/transmission.cpp

@@ -691,7 +691,7 @@ dxJointTransmission::type() const
     return dJointTypeTransmission;
 }
 
-size_t
+sizeint
 dxJointTransmission::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/transmission.h

@@ -44,7 +44,7 @@ struct dxJointTransmission : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex );
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 };
 
 

+ 1 - 1
ode/src/joints/universal.cpp

@@ -768,7 +768,7 @@ dxJointUniversal::type() const
 }
 
 
-size_t
+sizeint
 dxJointUniversal::size() const
 {
     return sizeof( *this );

+ 1 - 1
ode/src/joints/universal.h

@@ -54,7 +54,7 @@ struct dxJointUniversal : public dxJoint
         int pairskip, dReal *pairRhsCfm, dReal *pairLoHi, 
         int *findex);
     virtual dJointType type() const;
-    virtual size_t size() const;
+    virtual sizeint size() const;
 
     virtual void setRelativeValues();
 };

+ 36 - 36
ode/src/lcp.cpp

@@ -161,7 +161,7 @@ template<bool zero_b>
 inline 
 void transfer_b_to_x(dReal pairsbx[PBX__MAX], unsigned n)
 {
-    dReal *const endbx = pairsbx + (size_t)n * PBX__MAX;
+    dReal *const endbx = pairsbx + (sizeint)n * PBX__MAX;
     for (dReal *currbx = pairsbx; currbx != endbx; currbx += PBX__MAX) {
         currbx[PBX_X] = currbx[PBX_B];
         if (zero_b) {
@@ -211,8 +211,8 @@ void swapRowsAndCols (ATYPE A, unsigned n, unsigned i1, unsigned i2, unsigned ns
         dxSwap(A_j[i1], A_j[i2]);
     }
 # else
-    dReal *A_i1 = A + (size_t)nskip * i1;
-    dReal *A_i2 = A + (size_t)nskip * i2;
+    dReal *A_i1 = A + (sizeint)nskip * i1;
+    dReal *A_i2 = A + (sizeint)nskip * i2;
 
     for (unsigned k = 0; k < i1; ++k) {
         dxSwap(A_i1[k], A_i2[k]);
@@ -246,14 +246,14 @@ void swapProblem (ATYPE A, dReal pairsbx[PBX__MAX], dReal *w, dReal pairslh[PLH_
     if (i1 != i2) {
         swapRowsAndCols (A, n, i1, i2, nskip, do_fast_row_swaps);
 
-        dxSwap((pairsbx + (size_t)i1 * PBX__MAX)[PBX_B], (pairsbx + (size_t)i2 * PBX__MAX)[PBX_B]);
-        dxSwap((pairsbx + (size_t)i1 * PBX__MAX)[PBX_X], (pairsbx + (size_t)i2 * PBX__MAX)[PBX_X]);
+        dxSwap((pairsbx + (sizeint)i1 * PBX__MAX)[PBX_B], (pairsbx + (sizeint)i2 * PBX__MAX)[PBX_B]);
+        dxSwap((pairsbx + (sizeint)i1 * PBX__MAX)[PBX_X], (pairsbx + (sizeint)i2 * PBX__MAX)[PBX_X]);
         dSASSERT(PBX__MAX == 2);
 
         dxSwap(w[i1], w[i2]);
 
-        dxSwap((pairslh + (size_t)i1 * PLH__MAX)[PLH_LO], (pairslh + (size_t)i2 * PLH__MAX)[PLH_LO]);
-        dxSwap((pairslh + (size_t)i1 * PLH__MAX)[PLH_HI], (pairslh + (size_t)i2 * PLH__MAX)[PLH_HI]);
+        dxSwap((pairslh + (sizeint)i1 * PLH__MAX)[PLH_LO], (pairslh + (sizeint)i2 * PLH__MAX)[PLH_LO]);
+        dxSwap((pairslh + (sizeint)i1 * PLH__MAX)[PLH_HI], (pairslh + (sizeint)i2 * PLH__MAX)[PLH_HI]);
         dSASSERT(PLH__MAX == 2);
 
         dxSwap(p[i1], p[i2]);
@@ -387,7 +387,7 @@ struct dLCP {
     void transfer_i_to_N (unsigned /*i*/) { m_nN++; }			// because we can assume C and N span 1:i-1
     void transfer_i_from_N_to_C (unsigned i);
     void transfer_i_from_C_to_N (unsigned i, void *tmpbuf);
-    static size_t estimate_transfer_i_from_C_to_N_mem_req(unsigned nC, unsigned nskip) { return dEstimateLDLTRemoveTmpbufSize(nC, nskip); }
+    static sizeint estimate_transfer_i_from_C_to_N_mem_req(unsigned nC, unsigned nskip) { return dEstimateLDLTRemoveTmpbufSize(nC, nskip); }
     unsigned numC() const { return m_nC; }
     unsigned numN() const { return m_nN; }
     unsigned indexC (unsigned i) const { return i; }
@@ -396,7 +396,7 @@ struct dLCP {
     template<unsigned q_stride>
     dReal AiC_times_qC (unsigned i, dReal *q) const { return calculateLargeVectorDot<q_stride> (AROW(i), q, m_nC); }
     template<unsigned q_stride>
-    dReal AiN_times_qN (unsigned i, dReal *q) const { return calculateLargeVectorDot<q_stride> (AROW(i) + m_nC, q + (size_t)m_nC * q_stride, m_nN); }
+    dReal AiN_times_qN (unsigned i, dReal *q) const { return calculateLargeVectorDot<q_stride> (AROW(i) + m_nC, q + (sizeint)m_nC * q_stride, m_nN); }
     void pN_equals_ANC_times_qC (dReal *p, dReal *q);
     void pN_plusequals_ANi (dReal *p, unsigned i, bool dir_positive);
     template<unsigned p_stride>
@@ -474,7 +474,7 @@ dLCP::dLCP (unsigned _n, unsigned _nskip, unsigned _nub, dReal *_Adata, dReal *_
         const unsigned n = m_n;
         for (unsigned k = m_nub; k < n; ++k) {
             if (findex && findex[k] >= 0) continue;
-            if ((pairslh + (size_t)k * PLH__MAX)[PLH_LO] == -dInfinity && (pairslh + (size_t)k * PLH__MAX)[PLH_HI] == dInfinity) {
+            if ((pairslh + (sizeint)k * PLH__MAX)[PLH_LO] == -dInfinity && (pairslh + (sizeint)k * PLH__MAX)[PLH_HI] == dInfinity) {
                 swapProblem (m_A, m_pairsbx, m_w, pairslh, m_p, m_state, findex, n, m_nub, k, m_nskip, 0);
                 m_nub++;
             }
@@ -522,7 +522,7 @@ dLCP::dLCP (unsigned _n, unsigned _nskip, unsigned _nub, dReal *_Adata, dReal *_
     const unsigned nub = m_nub;
     for (unsigned k=0; k<n; k++) {
     if (k<nub) printf ("C");
-    else if ((m_pairslh + (size_t)k * PLH__MAX)[PLH_LO] == -dInfinity && (m_pairslh + (size_t)k * PLH__MAX)[PLH_HI] == dInfinity) printf ("c");
+    else if ((m_pairslh + (sizeint)k * PLH__MAX)[PLH_LO] == -dInfinity && (m_pairslh + (sizeint)k * PLH__MAX)[PLH_HI] == dInfinity) printf ("c");
     else printf (".");
     }
     printf ("\n");
@@ -538,7 +538,7 @@ void dLCP::transfer_i_to_C (unsigned i)
 
         if (nC > 0) {
             // ell,Dell were computed by solve1(). note, ell = D \ L1solve (L,A(i,C))
-            dReal *const Ltgt = m_L + (size_t)m_nskip * nC, *ell = m_ell;
+            dReal *const Ltgt = m_L + (sizeint)m_nskip * nC, *ell = m_ell;
             memcpy(Ltgt, ell, nC * sizeof(dReal));
 
             dReal ell_Dell_dot = dxDot(m_ell, m_Dell, nC);
@@ -584,7 +584,7 @@ void dLCP::transfer_i_from_N_to_C (unsigned i)
             solveL1Straight<1>(m_L, m_Dell, nC, m_nskip);
 
             dReal ell_Dell_dot = REAL(0.0);
-            dReal *const Ltgt = m_L + (size_t)m_nskip * nC;
+            dReal *const Ltgt = m_L + (sizeint)m_nskip * nC;
             dReal *ell = m_ell, *Dell = m_Dell, *d = m_d;
             for (unsigned j = 0; j < nC; ++j) {
                 dReal ell_j, Dell_j = Dell[j];
@@ -774,9 +774,9 @@ void dLCP::unpermute_X()
         unsigned k = p[j];
         if (k != j) {
             // p[j] = j; -- not going to be checked anymore anyway
-            dReal x_j = (pairsbx + (size_t)j * PBX__MAX)[PBX_X];
+            dReal x_j = (pairsbx + (sizeint)j * PBX__MAX)[PBX_X];
             for (;;) {
-                dxSwap(x_j, (pairsbx + (size_t)k * PBX__MAX)[PBX_X]);
+                dxSwap(x_j, (pairsbx + (sizeint)k * PBX__MAX)[PBX_X]);
 
                 unsigned orig_k = p[k];
                 p[k] = k;
@@ -785,7 +785,7 @@ void dLCP::unpermute_X()
                 }
                 k = orig_k;
             }
-            (pairsbx + (size_t)j * PBX__MAX)[PBX_X] = x_j;
+            (pairsbx + (sizeint)j * PBX__MAX)[PBX_X] = x_j;
         }
     }
 }
@@ -852,13 +852,13 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
 # ifndef dNODEBUG
     {
         // check restrictions on lo and hi
-        dReal *endlh = pairslh + (size_t)n * PLH__MAX;
+        dReal *endlh = pairslh + (sizeint)n * PLH__MAX;
         for (dReal *currlh = pairslh; currlh != endlh; currlh += PLH__MAX) dIASSERT (currlh[PLH_LO] <= 0 && currlh[PLH_HI] >= 0);
     }
 # endif
 
     const unsigned nskip = dPAD(n);
-    dReal *L = memarena->AllocateOveralignedArray<dReal> ((size_t)nskip * n, LMATRIX_ALIGNMENT);
+    dReal *L = memarena->AllocateOveralignedArray<dReal> ((sizeint)nskip * n, LMATRIX_ALIGNMENT);
     dReal *d = memarena->AllocateArray<dReal> (n);
     dReal *w = outer_w != NULL ? outer_w : memarena->AllocateArray<dReal> (n);
     dReal *delta_w = memarena->AllocateArray<dReal> (n);
@@ -908,11 +908,11 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
 
         if (!hit_first_friction_index && findex && findex[i] >= 0) {
             // un-permute x into delta_w, which is not being used at the moment
-            for (unsigned j = 0; j < n; ++j) delta_w[p[j]] = (pairsbx + (size_t)j * PBX__MAX)[PBX_X];
+            for (unsigned j = 0; j < n; ++j) delta_w[p[j]] = (pairsbx + (sizeint)j * PBX__MAX)[PBX_X];
 
             // set lo and hi values
             for (unsigned k = i; k < n; ++k) {
-                dReal *currlh = pairslh + (size_t)k * PLH__MAX;
+                dReal *currlh = pairslh + (sizeint)k * PLH__MAX;
                 dReal wfk = delta_w[findex[k]];
                 if (wfk == 0) {
                     currlh[PLH_HI] = 0;
@@ -930,7 +930,7 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
         // greater than i, so compute w[i] now.
         dReal wPrep = lcp.AiC_times_qC<PBX__MAX> (i, pairsbx + PBX_X) + lcp.AiN_times_qN<PBX__MAX> (i, pairsbx + PBX_X);
 
-        dReal *currbx = pairsbx + (size_t)i * PBX__MAX;
+        dReal *currbx = pairsbx + (sizeint)i * PBX__MAX;
 
         w[i] = wPrep - currbx[PBX_B];
 
@@ -944,7 +944,7 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
         // will never be checked for set changes. this means that the state for
         // these indexes may be incorrect, but that doesn't matter.
 
-        dReal *currlh = pairslh + (size_t)i * PLH__MAX;
+        dReal *currlh = pairslh + (sizeint)i * PLH__MAX;
 
         // see if x(i),w(i) is in a valid region
         if (currlh[PLH_LO] == 0 && w[i] >= 0) {
@@ -1020,7 +1020,7 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
                         const unsigned indexN_k = lcp.indexN(k);
                         if (!state[indexN_k] ? delta_w[indexN_k] < 0 : delta_w[indexN_k] > 0) {
                             // don't bother checking if lo=hi=0
-                            dReal *indexlh = pairslh + (size_t)indexN_k * PLH__MAX;
+                            dReal *indexlh = pairslh + (sizeint)indexN_k * PLH__MAX;
                             if (indexlh[PLH_LO] == 0 && indexlh[PLH_HI] == 0) continue;
                             dReal s2 = -w[indexN_k] / delta_w[indexN_k];
                             if (s2 < s) {
@@ -1036,9 +1036,9 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
                     const unsigned numC = lcp.numC();
                     for (unsigned k = adj_nub; k < numC; ++k) {
                         const unsigned indexC_k = lcp.indexC(k);
-                        dReal *indexlh = pairslh + (size_t)indexC_k * PLH__MAX;
+                        dReal *indexlh = pairslh + (sizeint)indexC_k * PLH__MAX;
                         if (delta_x[indexC_k] < 0 && indexlh[PLH_LO] > -dInfinity) {
-                            dReal s2 = (indexlh[PLH_LO] - (pairsbx + (size_t)indexC_k * PBX__MAX)[PBX_X]) / delta_x[indexC_k];
+                            dReal s2 = (indexlh[PLH_LO] - (pairsbx + (sizeint)indexC_k * PBX__MAX)[PBX_X]) / delta_x[indexC_k];
                             if (s2 < s) {
                                 s = s2;
                                 cmd = 5;
@@ -1046,7 +1046,7 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
                             }
                         }
                         if (delta_x[indexC_k] > 0 && indexlh[PLH_HI] < dInfinity) {
-                            dReal s2 = (indexlh[PLH_HI] - (pairsbx + (size_t)indexC_k * PBX__MAX)[PBX_X]) / delta_x[indexC_k];
+                            dReal s2 = (indexlh[PLH_HI] - (pairsbx + (sizeint)indexC_k * PBX__MAX)[PBX_X]) / delta_x[indexC_k];
                             if (s2 < s) {
                                 s = s2;
                                 cmd = 6;
@@ -1105,13 +1105,13 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
                     lcp.transfer_i_from_N_to_C (si);
                     break;
                 case 5:		// keep going
-                    (pairsbx + (size_t)si * PBX__MAX)[PBX_X] = (pairslh + (size_t)si * PLH__MAX)[PLH_LO];
+                    (pairsbx + (sizeint)si * PBX__MAX)[PBX_X] = (pairslh + (sizeint)si * PLH__MAX)[PLH_LO];
                     state[si] = false;
                     tmpbuf = memarena->PeekBufferRemainder();
                     lcp.transfer_i_from_C_to_N (si, tmpbuf);
                     break;
                 case 6:		// keep going
-                    (pairsbx + (size_t)si * PBX__MAX)[PBX_X] = (pairslh + (size_t)si * PLH__MAX)[PLH_HI];
+                    (pairsbx + (sizeint)si * PBX__MAX)[PBX_X] = (pairslh + (sizeint)si * PLH__MAX)[PLH_HI];
                     state[si] = true;
                     tmpbuf = memarena->PeekBufferRemainder();
                     lcp.transfer_i_from_C_to_N (si, tmpbuf);
@@ -1134,13 +1134,13 @@ void dxSolveLCP_Generic (dxWorldProcessMemArena *memarena, unsigned n, dReal *A,
     lcp.unpermute_X(); // This destroys p[] and must be done last
 }
 
-size_t dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail)
+sizeint dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail)
 {
     const unsigned nskip = dPAD(n);
 
-    size_t res = 0;
+    sizeint res = 0;
 
-    res += dOVERALIGNED_SIZE(sizeof(dReal) * ((size_t)n * nskip), LMATRIX_ALIGNMENT); // for L
+    res += dOVERALIGNED_SIZE(sizeof(dReal) * ((sizeint)n * nskip), LMATRIX_ALIGNMENT); // for L
     res += 5 * dEFFICIENT_SIZE(sizeof(dReal) * n); // for d, delta_w, delta_x, Dell, ell
     if (!outer_w_avail) {
         res += dEFFICIENT_SIZE(sizeof(dReal) * n); // for w
@@ -1152,7 +1152,7 @@ size_t dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail)
     res += dEFFICIENT_SIZE(sizeof(bool) * n); // for state
 
     // Use n instead of nC as nC varies at runtime while n is greater or equal to nC
-    size_t lcp_transfer_req = dLCP::estimate_transfer_i_from_C_to_N_mem_req(n, nskip);
+    sizeint lcp_transfer_req = dLCP::estimate_transfer_i_from_C_to_N_mem_req(n, nskip);
     res += dEFFICIENT_SIZE(lcp_transfer_req); // for dLCP::transfer_i_from_C_to_N
 
     return res;
@@ -1162,13 +1162,13 @@ size_t dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail)
 //***************************************************************************
 // accuracy and timing test
 
-static size_t EstimateTestSolveLCPMemoryReq(unsigned n)
+static sizeint EstimateTestSolveLCPMemoryReq(unsigned n)
 {
     const unsigned nskip = dPAD(n);
 
-    size_t res = 0;
+    sizeint res = 0;
 
-    res += 2 * dEFFICIENT_SIZE(sizeof(dReal) * ((size_t)n * nskip)); // for A, A2
+    res += 2 * dEFFICIENT_SIZE(sizeof(dReal) * ((sizeint)n * nskip)); // for A, A2
     res += 7 * dEFFICIENT_SIZE(sizeof(dReal) * n); // for x, b, w, lo, hi, tmp1, tmp2
     res += dEFFICIENT_SIZE(sizeof(dReal) * PBX__MAX * n); // for pairsbx, 
     res += dEFFICIENT_SIZE(sizeof(dReal) * PLH__MAX * n); // for pairslh
@@ -1182,7 +1182,7 @@ extern "C" ODE_API int dTestSolveLCP()
 {
     const unsigned n = 100;
 
-    size_t memreq = EstimateTestSolveLCPMemoryReq(n);
+    sizeint memreq = EstimateTestSolveLCPMemoryReq(n);
     dxWorldProcessMemArena *arena = dxAllocateTemporaryWorldProcessMemArena(memreq, NULL, NULL);
     if (arena == NULL) {
         return 0;

+ 1 - 1
ode/src/lcp.h

@@ -76,6 +76,6 @@ void dxSolveLCP (dxWorldProcessMemArena *memarena,
     unsigned n, dReal *A, dReal pairsbx[PBX__MAX], dReal *w,
     unsigned nub, dReal pairslh[PLH__MAX], int *findex);
 
-size_t dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail);
+sizeint dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail);
 
 #endif

+ 19 - 19
ode/src/matrix.cpp

@@ -110,7 +110,7 @@ int dxFactorCholesky(dReal *A, unsigned n, void *tmpBuf/*[n]*/)
     bool failure = false;
     
     dReal *alloctedBuf = NULL;
-    size_t allocatedSize;
+    sizeint allocatedSize;
 
     const unsigned nskip = dPAD (n);
     
@@ -165,7 +165,7 @@ void dxSolveCholesky(const dReal *L, dReal *b, unsigned n, void *tmpBuf/*[n]*/)
     dAASSERT (n > 0 && L && b);
 
     dReal *alloctedBuf = NULL;
-    size_t allocatedSize;
+    sizeint allocatedSize;
 
     const unsigned nskip = dPAD (n);
 
@@ -214,15 +214,15 @@ int dxInvertPDMatrix(const dReal *A, dReal *Ainv, unsigned n, void *tmpBuf/*[nsk
     bool success = false;
 
     dReal *alloctedBuf = NULL;
-    size_t allocatedSize;
+    sizeint allocatedSize;
 
-    size_t choleskyFactorSize = dxEstimateFactorCholeskyTmpbufSize(n);
-    size_t choleskySolveSize = dxEstimateSolveCholeskyTmpbufSize(n);
-    size_t choleskyMaxSize = dMACRO_MAX(choleskyFactorSize, choleskySolveSize);
+    sizeint choleskyFactorSize = dxEstimateFactorCholeskyTmpbufSize(n);
+    sizeint choleskySolveSize = dxEstimateSolveCholeskyTmpbufSize(n);
+    sizeint choleskyMaxSize = dMACRO_MAX(choleskyFactorSize, choleskySolveSize);
     dIASSERT(choleskyMaxSize % sizeof(dReal) == 0);
 
     const unsigned nskip = dPAD (n);
-    const size_t nskip_mul_n = (size_t)nskip * n;
+    const sizeint nskip_mul_n = (sizeint)nskip * n;
     
     dReal *tmp = (dReal *)tmpBuf;
     if (tmpBuf == NULL) {
@@ -264,13 +264,13 @@ int dxIsPositiveDefinite(const dReal *A, unsigned n, void *tmpBuf/*[nskip*(n+1)]
     dAASSERT (n > 0 && A);
 
     dReal *alloctedBuf = NULL;
-    size_t allocatedSize;
+    sizeint allocatedSize;
 
-    size_t choleskyFactorSize = dxEstimateFactorCholeskyTmpbufSize(n);
+    sizeint choleskyFactorSize = dxEstimateFactorCholeskyTmpbufSize(n);
     dIASSERT(choleskyFactorSize % sizeof(dReal) == 0);
 
     const unsigned nskip = dPAD (n);
-    const size_t nskip_mul_n = (size_t)nskip * n;
+    const sizeint nskip_mul_n = (sizeint)nskip * n;
     
     dReal *tmp = (dReal *)tmpBuf;
     if (tmpBuf == NULL) {
@@ -299,7 +299,7 @@ void dxLDLTAddTL(dReal *L, dReal *d, const dReal *a, unsigned n, unsigned nskip,
     if (n < 2) return;
 
     dReal *alloctedBuf = NULL;
-    size_t allocatedSize;
+    sizeint allocatedSize;
 
     dReal *W1 = (dReal *)tmpBuf;
     if (tmpBuf == NULL) {
@@ -409,9 +409,9 @@ void dxLDLTRemove(dReal **A, const unsigned *p, dReal *L, dReal *d,
     }
 
     dReal *alloctedBuf = NULL;
-    size_t allocatedSize;
+    sizeint allocatedSize;
 
-    size_t LDLTAddTLSize = dxEstimateLDLTAddTLTmpbufSize(nskip);
+    sizeint LDLTAddTLSize = dxEstimateLDLTAddTLTmpbufSize(nskip);
     dIASSERT(LDLTAddTLSize % sizeof(dReal) == 0);
     
     dReal *tmp = (dReal *)tmpBuf;
@@ -449,7 +449,7 @@ void dxLDLTRemove(dReal **A, const unsigned *p, dReal *L, dReal *d,
             }
         }
         a[0] += REAL(1.0);
-        dxLDLTAddTL (L + (size_t)(nskip + 1) * r, d + r, a, n2 - r, nskip, tmp);
+        dxLDLTAddTL (L + (sizeint)(nskip + 1) * r, d + r, a, n2 - r, nskip, tmp);
     }
 
     // snip out row/column r from L and d
@@ -469,7 +469,7 @@ void dxRemoveRowCol(dReal *A, unsigned n, unsigned nskip, unsigned r)
     if (r >= n - 1) return;
     if (r > 0) {
         {
-            const size_t move_size = (n - r - 1) * sizeof(dReal);
+            const sizeint move_size = (n - r - 1) * sizeof(dReal);
             dReal *Adst = A + r;
             for (unsigned i = 0; i < r; Adst += nskip, ++i) {
                 dReal *Asrc = Adst + 1;
@@ -477,8 +477,8 @@ void dxRemoveRowCol(dReal *A, unsigned n, unsigned nskip, unsigned r)
             }
         }
         {
-            const size_t cpy_size = r * sizeof(dReal);
-            dReal *Adst = A + (size_t)nskip * r;
+            const sizeint cpy_size = r * sizeof(dReal);
+            dReal *Adst = A + (sizeint)nskip * r;
             unsigned n1 = n - 1;
             for (unsigned i = r; i < n1; ++i) {
                 dReal *Asrc = Adst + nskip;
@@ -488,8 +488,8 @@ void dxRemoveRowCol(dReal *A, unsigned n, unsigned nskip, unsigned r)
         }
     }
     {
-        const size_t cpy_size = (n - r - 1) * sizeof(dReal);
-        dReal *Adst = A + (size_t)(nskip + 1) * r;
+        const sizeint cpy_size = (n - r - 1) * sizeof(dReal);
+        dReal *Adst = A + (sizeint)(nskip + 1) * r;
         unsigned n1 = n - 1;
         for (unsigned i = r; i < n1; ++i) {
             dReal *Asrc = Adst + (nskip + 1);

+ 16 - 16
ode/src/matrix.h

@@ -36,7 +36,7 @@
 
 template <unsigned a_stride, typename element_type>
 ODE_INLINE
-void dxtSetZero (element_type *a, size_t n)
+void dxtSetZero (element_type *a, sizeint n)
 {
     element_type *const aend = a + n * a_stride;
     for (element_type *acurr = a; acurr != aend; acurr += a_stride) {
@@ -46,14 +46,14 @@ void dxtSetZero (element_type *a, size_t n)
 
 template <typename element_type>
 ODE_INLINE
-void dxSetZero (element_type *a, size_t n)
+void dxSetZero (element_type *a, sizeint n)
 {
     dxtSetZero<1>(a, n);
 }
 
 template <typename element_type>
 ODE_INLINE
-void dxSetValue (element_type *a, size_t n, element_type value)
+void dxSetValue (element_type *a, sizeint n, element_type value)
 {
     element_type *const aend = a + n;
     for (element_type *acurr = a; acurr != aend; ++acurr) {
@@ -65,7 +65,7 @@ void dxSetValue (element_type *a, size_t n, element_type value)
 #else // #ifndef __cplusplus
 
 ODE_PURE_INLINE
-void dxSetZero (dReal *a, size_t n)
+void dxSetZero (dReal *a, sizeint n)
 {
     dReal *const aend = a + n;
     dReal *acurr;
@@ -75,7 +75,7 @@ void dxSetZero (dReal *a, size_t n)
 }
 
 ODE_PURE_INLINE
-void dxSetValue (dReal *a, size_t n, dReal value)
+void dxSetValue (dReal *a, sizeint n, dReal value)
 {
     dReal *const aend = a + n;
     dReal *acurr;
@@ -100,35 +100,35 @@ void dxLDLTAddTL (dReal *L, dReal *d, const dReal *a, unsigned n, unsigned nskip
 void dxLDLTRemove (dReal **A, const unsigned *p, dReal *L, dReal *d, unsigned n1, unsigned n2, unsigned r, unsigned nskip, void *tmpbuf);
 void dxRemoveRowCol (dReal *A, unsigned n, unsigned nskip, unsigned r);
 
-ODE_PURE_INLINE size_t dxEstimateFactorCholeskyTmpbufSize(unsigned n)
+ODE_PURE_INLINE sizeint dxEstimateFactorCholeskyTmpbufSize(unsigned n)
 {
     return dPAD(n) * sizeof(dReal);
 }
 
-ODE_PURE_INLINE size_t dxEstimateSolveCholeskyTmpbufSize(unsigned n)
+ODE_PURE_INLINE sizeint dxEstimateSolveCholeskyTmpbufSize(unsigned n)
 {
     return dPAD(n) * sizeof(dReal);
 }
 
-ODE_PURE_INLINE size_t dxEstimateInvertPDMatrixTmpbufSize(unsigned n)
+ODE_PURE_INLINE sizeint dxEstimateInvertPDMatrixTmpbufSize(unsigned n)
 {
-    size_t FactorCholesky_size = dxEstimateFactorCholeskyTmpbufSize(n);
-    size_t SolveCholesky_size = dxEstimateSolveCholeskyTmpbufSize(n);
-    size_t MaxCholesky_size = FactorCholesky_size > SolveCholesky_size ? FactorCholesky_size : SolveCholesky_size;
-    return (size_t)dPAD(n) * (n + 1) * sizeof(dReal) + MaxCholesky_size;
+    sizeint FactorCholesky_size = dxEstimateFactorCholeskyTmpbufSize(n);
+    sizeint SolveCholesky_size = dxEstimateSolveCholeskyTmpbufSize(n);
+    sizeint MaxCholesky_size = FactorCholesky_size > SolveCholesky_size ? FactorCholesky_size : SolveCholesky_size;
+    return (sizeint)dPAD(n) * (n + 1) * sizeof(dReal) + MaxCholesky_size;
 }
 
-ODE_PURE_INLINE size_t dxEstimateIsPositiveDefiniteTmpbufSize(unsigned n)
+ODE_PURE_INLINE sizeint dxEstimateIsPositiveDefiniteTmpbufSize(unsigned n)
 {
-    return (size_t)dPAD(n) * n * sizeof(dReal) + dxEstimateFactorCholeskyTmpbufSize(n);
+    return (sizeint)dPAD(n) * n * sizeof(dReal) + dxEstimateFactorCholeskyTmpbufSize(n);
 }
 
-ODE_PURE_INLINE size_t dxEstimateLDLTAddTLTmpbufSize(unsigned nskip)
+ODE_PURE_INLINE sizeint dxEstimateLDLTAddTLTmpbufSize(unsigned nskip)
 {
     return nskip * (2 * sizeof(dReal));
 }
 
-ODE_PURE_INLINE size_t dxEstimateLDLTRemoveTmpbufSize(unsigned n2, unsigned nskip)
+ODE_PURE_INLINE sizeint dxEstimateLDLTRemoveTmpbufSize(unsigned n2, unsigned nskip)
 {
     return n2 * sizeof(dReal) + dxEstimateLDLTAddTLTmpbufSize(nskip);
 }

+ 3 - 3
ode/src/memory.cpp

@@ -75,20 +75,20 @@ dFreeFunction *dGetFreeHandler()
 }
 
 
-void * dAlloc (size_t size)
+void * dAlloc (sizeint size)
 {
     if (allocfn) return allocfn (size); else return malloc (size);
 }
 
 
-void * dRealloc (void *ptr, size_t oldsize, size_t newsize)
+void * dRealloc (void *ptr, sizeint oldsize, sizeint newsize)
 {
     if (reallocfn) return reallocfn (ptr,oldsize,newsize);
     else return realloc (ptr,newsize);
 }
 
 
-void dFree (void *ptr, size_t size)
+void dFree (void *ptr, sizeint size)
 {
     if (!ptr) return;
     if (freefn) freefn (ptr,size); else free (ptr);

+ 4 - 4
ode/src/obstack.cpp

@@ -31,10 +31,10 @@
 // macros and constants
 
 #define ROUND_UP_OFFSET_TO_EFFICIENT_SIZE(arena,ofs) \
-    ofs = (size_t) (dEFFICIENT_SIZE( ((size_t)(arena)) + ofs ) - ((size_t)(arena)) )
+    ofs = (sizeint) (dEFFICIENT_SIZE( ((sizeint)(arena)) + ofs ) - ((sizeint)(arena)) )
 
 #define MAX_ALLOC_SIZE \
-    ((size_t)(dOBSTACK_ARENA_SIZE - sizeof (Arena) - EFFICIENT_ALIGNMENT + 1))
+    ((sizeint)(dOBSTACK_ARENA_SIZE - sizeof (Arena) - EFFICIENT_ALIGNMENT + 1))
 
 //****************************************************************************
 // dObStack
@@ -59,7 +59,7 @@ dObStack::~dObStack()
 }
 
 
-void *dObStack::alloc (size_t num_bytes)
+void *dObStack::alloc (sizeint num_bytes)
 {
     if (num_bytes > MAX_ALLOC_SIZE) dDebug (0,"num_bytes too large");
 
@@ -124,7 +124,7 @@ void *dObStack::rewind()
     return switch_to_arena(m_first);
 }
 
-void *dObStack::next (size_t num_bytes)
+void *dObStack::next (sizeint num_bytes)
 {
     // this functions like alloc, except that no new storage is ever allocated
     if (!m_current_arena) {

+ 4 - 4
ode/src/obstack.h

@@ -33,7 +33,7 @@ struct dObStack : public dBase {
     dObStack();
     ~dObStack();
 
-    void *alloc (size_t num_bytes);
+    void *alloc (sizeint num_bytes);
     // allocate a block in the last arena, allocating a new arena if necessary.
     // it is a runtime error if num_bytes is larger than the arena size.
 
@@ -45,7 +45,7 @@ struct dObStack : public dBase {
     // rewind the obstack iterator, and return the address of the first
     // allocated block. return 0 if there are no allocated blocks.
 
-    void *next (size_t num_bytes);
+    void *next (sizeint num_bytes);
     // return the address of the next allocated block. 'num_bytes' is the size
     // of the previous block. this returns null if there are no more arenas.
     // the sequence of 'num_bytes' parameters passed to next() during a
@@ -54,7 +54,7 @@ struct dObStack : public dBase {
 private:
     struct Arena {
         Arena *m_next;	// next arena in linked list
-        size_t m_used;		// total number of bytes used in this arena, counting
+        sizeint m_used;		// total number of bytes used in this arena, counting
     };			//   this header
 
 private:
@@ -66,7 +66,7 @@ private:
 
     // used for iterator
     Arena *m_current_arena;
-    size_t m_current_ofs;
+    sizeint m_current_ofs;
 };
 
 

+ 8 - 8
ode/src/ode.cpp

@@ -1324,13 +1324,13 @@ void dJointGroupEmpty (dJointGroupID group)
 {
     dAASSERT (group);
 
-    const size_t num_joints = group->getJointCount();
+    const sizeint num_joints = group->getJointCount();
     if (num_joints != 0) {
         // Local array is used since ALLOCA leads to mysterious NULL values in first array element and crashes under VS2005 :)
-        const size_t max_stack_jlist_size = 1024;
+        const sizeint max_stack_jlist_size = 1024;
         dxJoint *stack_jlist[max_stack_jlist_size];
 
-        const size_t jlist_size = num_joints * sizeof(dxJoint*);
+        const sizeint jlist_size = num_joints * sizeof(dxJoint*);
         dxJoint **jlist = num_joints <= max_stack_jlist_size ? stack_jlist : (dxJoint **)dAlloc(jlist_size);
 
         if (jlist != NULL) {
@@ -1338,17 +1338,17 @@ void dJointGroupEmpty (dJointGroupID group)
             // added (at the top of the stack). this helps ensure that the various
             // linked lists are not traversed too much, as the joints will hopefully
             // be at the start of those lists.
-            size_t num_exported = group->exportJoints(jlist);
+            sizeint num_exported = group->exportJoints(jlist);
             dIVERIFY(num_exported == num_joints);
 
-            for (size_t i = num_joints; i != 0; ) {
+            for (sizeint i = num_joints; i != 0; ) {
                 --i;
                 dxJoint *j = jlist[i];
                 FinalizeAndDestroyJointInstance(j, false);
             }
         } else {
             // ...else if there is no memory, go on detaching the way it is possible
-            size_t joint_bytes;
+            sizeint joint_bytes;
             for (dxJoint *j = (dxJoint *)group->beginEnum(); j != NULL; j = (dxJoint *)group->continueEnum(joint_bytes)) {
                 joint_bytes = j->size(); // Get size before object is destroyed!
                 FinalizeAndDestroyJointInstance(j, false);
@@ -1610,7 +1610,7 @@ void dWorldDestroy (dxWorld *w)
         }
         else {
             // TODO: shouldn't we call dJointDestroy()?
-            size_t sz = j->size();
+            sizeint sz = j->size();
             j->~dxJoint();
             dFree (j,sz);
         }
@@ -2295,7 +2295,7 @@ int dCheckConfiguration( const char* extension )
 
     const char* config = dGetConfiguration();
 
-    const size_t ext_length = strlen(extension);
+    const sizeint ext_length = strlen(extension);
 
     /* It takes a bit of care to be fool-proof. Don't be fooled by sub-strings, etc. */
     start = config;

+ 1 - 1
ode/src/odetls.cpp

@@ -100,7 +100,7 @@ void COdeTls::CleanupForThread()
 
 bool COdeTls::AssignDataAllocationFlags(EODETLSKIND tkTLSKind, unsigned uInitializationFlags)
 {
-    bool bResult = CThreadLocalStorage::SetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS, (tlsvaluetype)(size_t)uInitializationFlags);
+    bool bResult = CThreadLocalStorage::SetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS, (tlsvaluetype)(sizeint)uInitializationFlags);
     return bResult;
 }
 

+ 5 - 5
ode/src/odetls.h

@@ -83,19 +83,19 @@ public:
     static unsigned GetDataAllocationFlags(EODETLSKIND tkTLSKind)
     {
         // Must be a safe call as it is used to test if TLS slot is allocated at all
-        return (unsigned)(size_t)CThreadLocalStorage::GetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS);
+        return (unsigned)(sizeint)CThreadLocalStorage::GetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS);
     }
 
     static void SignalDataAllocationFlags(EODETLSKIND tkTLSKind, unsigned uFlagsMask)
     {
-        unsigned uCurrentFlags = (unsigned)(size_t)CThreadLocalStorage::UnsafeGetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS);
-        CThreadLocalStorage::UnsafeSetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS, (tlsvaluetype)(size_t)(uCurrentFlags | uFlagsMask));
+        unsigned uCurrentFlags = (unsigned)(sizeint)CThreadLocalStorage::UnsafeGetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS);
+        CThreadLocalStorage::UnsafeSetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS, (tlsvaluetype)(sizeint)(uCurrentFlags | uFlagsMask));
     }
 
     static void DropDataAllocationFlags(EODETLSKIND tkTLSKind, unsigned uFlagsMask)
     {
-        unsigned uCurrentFlags = (unsigned)(size_t)CThreadLocalStorage::UnsafeGetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS);
-        CThreadLocalStorage::UnsafeSetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS, (tlsvaluetype)(size_t)(uCurrentFlags & ~uFlagsMask));
+        unsigned uCurrentFlags = (unsigned)(sizeint)CThreadLocalStorage::UnsafeGetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS);
+        CThreadLocalStorage::UnsafeSetStorageValue(m_ahtkStorageKeys[tkTLSKind], OTI_DATA_ALLOCATION_FLAGS, (tlsvaluetype)(sizeint)(uCurrentFlags & ~uFlagsMask));
     }
 
     static TrimeshCollidersCache *GetTrimeshCollidersCache(EODETLSKIND tkTLSKind)

+ 63 - 63
ode/src/quickstep.cpp

@@ -805,21 +805,21 @@ void compute_invM_JT (volatile atomicord32 *mi_storage, dReal *iMJ,
         unsigned int mi = mi_step * step_size;
         const unsigned int miend = mi + dMIN(step_size, m - mi);
 
-        dReal *iMJ_ptr = iMJ + (size_t)mi * IMJ__MAX;
-        const dReal *J_ptr = J + (size_t)mi * JME__MAX;
+        dReal *iMJ_ptr = iMJ + (sizeint)mi * IMJ__MAX;
+        const dReal *J_ptr = J + (sizeint)mi * JME__MAX;
         while (true) {
             int b1 = jb[mi].first;
             int b2 = jb[mi].second;
 
             dReal k1 = body[(unsigned)b1]->invMass;
             for (unsigned int j = 0; j != JVE__L_COUNT; j++) iMJ_ptr[IMJ__1L_MIN + j] = k1 * J_ptr[JME__J1L_MIN + j];
-            const dReal *invIrow1 = invI + (size_t)(unsigned)b1 * IIE__MAX + IIE__MATRIX_MIN;
+            const dReal *invIrow1 = invI + (sizeint)(unsigned)b1 * IIE__MAX + IIE__MATRIX_MIN;
             dMultiply0_331 (iMJ_ptr + IMJ__1A_MIN, invIrow1, J_ptr + JME__J1A_MIN);
 
             if (b2 != -1) {
                 dReal k2 = body[(unsigned)b2]->invMass;
                 for (unsigned int j = 0; j != JVE__L_COUNT; ++j) iMJ_ptr[IMJ__2L_MIN + j] = k2 * J_ptr[JME__J2L_MIN + j];
-                const dReal *invIrow2 = invI + (size_t)(unsigned)b2 * IIE__MAX + IIE__MATRIX_MIN;
+                const dReal *invIrow2 = invI + (sizeint)(unsigned)b2 * IIE__MAX + IIE__MATRIX_MIN;
                 dMultiply0_331 (iMJ_ptr + IMJ__2A_MIN, invIrow2, J_ptr + JME__J2A_MIN);
             }
         
@@ -862,11 +862,11 @@ void multiply_invM_JT_prepare(volatile atomicord32 *mi_storage,
 
             const unsigned encoded_mi = dxENCODE_INDEX(mi);
             unsigned oldIndex_b1 = ThrsafeExchange(&bi_links[b1], encoded_mi);
-            mi_links[(size_t)mi * 2] = oldIndex_b1;
+            mi_links[(sizeint)mi * 2] = oldIndex_b1;
 
             if (b2 != -1) {
                 unsigned oldIndex_b2 = ThrsafeExchange(&bi_links[b2], encoded_mi);
-                mi_links[(size_t)mi * 2 + 1] = oldIndex_b2;
+                mi_links[(sizeint)mi * 2 + 1] = oldIndex_b2;
             }
 
             if (++mi == miend) {
@@ -890,7 +890,7 @@ void multiply_invM_JT_complete(volatile atomicord32 *bi_storage, dReal *out,
         unsigned int bi = bi_step * step_size;
         const unsigned int biend = bi + dMIN(step_size, nb - bi);
 
-        dReal *out_ptr = out + (size_t)bi * out_stride + out_offset;
+        dReal *out_ptr = out + (sizeint)bi * out_stride + out_offset;
         while (true) {
             dReal psum0 = REAL(0.0), psum1 = REAL(0.0), psum2 = REAL(0.0), psum3 = REAL(0.0), psum4 = REAL(0.0), psum5 = REAL(0.0);
 
@@ -900,14 +900,14 @@ void multiply_invM_JT_complete(volatile atomicord32 *bi_storage, dReal *out,
                 const dReal *iMJ_ptr;
                 
                 if (bi == jb[mi].first) {
-                    iMJ_ptr = iMJ + (size_t)mi * IMJ__MAX + IMJ__1_MIN;
-                    businessIndex = mi_links[(size_t)mi * 2];
+                    iMJ_ptr = iMJ + (sizeint)mi * IMJ__MAX + IMJ__1_MIN;
+                    businessIndex = mi_links[(sizeint)mi * 2];
                 }
                 else {
                     dIASSERT(bi == jb[mi].second);
 
-                    iMJ_ptr = iMJ + (size_t)mi * IMJ__MAX + IMJ__2_MIN;
-                    businessIndex = mi_links[(size_t)mi * 2 + 1];
+                    iMJ_ptr = iMJ + (sizeint)mi * IMJ__MAX + IMJ__2_MIN;
+                    businessIndex = mi_links[(sizeint)mi * 2 + 1];
                 }
 
                 const dReal in_i = in[mi];
@@ -930,20 +930,20 @@ template<unsigned int out_offset, unsigned int out_stride>
 void _multiply_invM_JT (dReal *out, 
     unsigned int m, unsigned int nb, dReal *iMJ, const dxJBodiesItem *jb, const dReal *in)
 {
-    dSetZero (out, (size_t)nb * out_stride);
+    dSetZero (out, (sizeint)nb * out_stride);
     const dReal *iMJ_ptr = iMJ;
     for (unsigned int i=0; i<m; i++) {
         int b1 = jb[i].first;
         int b2 = jb[i].second;
         const dReal in_i = in[i];
 
-        dReal *out_ptr = out + (size_t)(unsigned)b1 * out_stride + out_offset;
+        dReal *out_ptr = out + (sizeint)(unsigned)b1 * out_stride + out_offset;
         for (unsigned int j = JVE__MIN; j != JVE__MAX; j++) out_ptr[j - JVE__MIN] += iMJ_ptr[IMJ__1_MIN + j] * in_i;
         dSASSERT(out_stride - out_offset >= JVE__MAX);
         dSASSERT(JVE__MAX == (int)dDA__MAX);
 
         if (b2 != -1) {
-            out_ptr = out + (size_t)(unsigned)b2 * out_stride + out_offset;
+            out_ptr = out + (sizeint)(unsigned)b2 * out_stride + out_offset;
             for (unsigned int j = JVE__MIN; j != JVE__MAX; j++) out_ptr[j - JVE__MIN] += iMJ_ptr[IMJ__2_MIN + j] * in_i;
             dSASSERT(out_stride - out_offset >= JVE__MAX);
             dSASSERT(JVE__MAX == (int)dDA__MAX);
@@ -966,17 +966,17 @@ void multiplyAdd_J (volatile atomicord32 *mi_storage,
         unsigned int mi = mi_step * step_size;
         const unsigned int miend = mi + dMIN(step_size, m - mi);
 
-        dReal *J_ptr = J + (size_t)mi * JME__MAX;
+        dReal *J_ptr = J + (sizeint)mi * JME__MAX;
         while (true) {
             int b1 = jb[mi].first;
             int b2 = jb[mi].second;
             dReal sum = REAL(0.0);
-            const dReal *in_ptr = in + (size_t)(unsigned)b1 * in_stride + in_offset;
+            const dReal *in_ptr = in + (sizeint)(unsigned)b1 * in_stride + in_offset;
             for (unsigned int j = 0; j != JME__J1_COUNT; ++j) sum += J_ptr[j + JME__J1_MIN] * in_ptr[j];
             dSASSERT(in_offset + JME__J1_COUNT <= in_stride);
 
             if (b2 != -1) {
-                in_ptr = in + (size_t)(unsigned)b2 * in_stride + in_offset;
+                in_ptr = in + (sizeint)(unsigned)b2 * in_stride + in_offset;
                 for (unsigned int j = 0; j != JME__J2_COUNT; ++j) sum += J_ptr[j + JME__J2_MIN] * in_ptr[j];
                 dSASSERT(in_offset + JME__J2_COUNT <= in_stride);
             }
@@ -1037,7 +1037,7 @@ void dxQuickStepIsland(const dxStepperProcessingCallContext *callContext)
     unsigned int nb = callContext->m_islandBodiesCount;
     unsigned int _nj = callContext->m_islandJointsCount;
 
-    dReal *invI = memarena->AllocateOveralignedArray<dReal>((size_t)nb * IIE__MAX, INVI_ALIGNMENT);
+    dReal *invI = memarena->AllocateOveralignedArray<dReal>((sizeint)nb * IIE__MAX, INVI_ALIGNMENT);
     dJointWithInfo1 *const jointinfos = memarena->AllocateArray<dJointWithInfo1>(_nj);
 
     const unsigned allowedThreads = callContext->m_stepperAllowedThreads;
@@ -1150,7 +1150,7 @@ void dxQuickStepIsland_Stage0_Bodies(dxQuickStepperStage0BodiesCallContext *call
         dReal *invI = callContext->m_invI;
         unsigned int bodyIndex;
         while ((bodyIndex = ThrsafeIncrementIntUpToLimit(&callContext->m_inertiaBodyIndex, nb)) != nb) {
-            dReal *invIrow = invI + (size_t)bodyIndex * IIE__MAX;
+            dReal *invIrow = invI + (sizeint)bodyIndex * IIE__MAX;
             dxBody *b = body[bodyIndex];
 
             dMatrix3 tmp;
@@ -1268,7 +1268,7 @@ void dxQuickStepIsland_Stage0_Joints(dxQuickStepperStage0JointsCallContext *call
         callContext->m_stage0Outputs->m = mcurr;
         callContext->m_stage0Outputs->mfb = mfbcurr;
         callContext->m_stage0Outputs->nj = (unsigned int)(jicurr - callContext->m_jointinfos); 
-        dIASSERT((size_t)(jicurr - callContext->m_jointinfos) < UINT_MAX || (size_t)(jicurr - callContext->m_jointinfos) == UINT_MAX); // to avoid "...always evaluates to true" warnings
+        dIASSERT((sizeint)(jicurr - callContext->m_jointinfos) < UINT_MAX || (sizeint)(jicurr - callContext->m_jointinfos) == UINT_MAX); // to avoid "...always evaluates to true" warnings
     }
 }
 
@@ -1330,8 +1330,8 @@ void dxQuickStepIsland_Stage1(dxQuickStepperStage1CallContext *stage1CallContext
 
         jb = memarena->AllocateArray<dxJBodiesItem>(m);
         findex = memarena->AllocateArray<int>(m);
-        J = memarena->AllocateOveralignedArray<dReal>((size_t)m * JME__MAX, JACOBIAN_ALIGNMENT);
-        Jcopy = memarena->AllocateOveralignedArray<dReal>((size_t)mfb * JCE__MAX, JCOPY_ALIGNMENT);
+        J = memarena->AllocateOveralignedArray<dReal>((sizeint)m * JME__MAX, JACOBIAN_ALIGNMENT);
+        Jcopy = memarena->AllocateOveralignedArray<dReal>((sizeint)mfb * JCE__MAX, JCOPY_ALIGNMENT);
     }
 
     dxQuickStepperLocalContext *localContext = (dxQuickStepperLocalContext *)memarena->AllocateBlock(sizeof(dxQuickStepperLocalContext));
@@ -1346,7 +1346,7 @@ void dxQuickStepIsland_Stage1(dxQuickStepperStage1CallContext *stage1CallContext
         // create a constraint equation right hand side vector `rhs', a constraint
         // force mixing vector `cfm', and LCP low and high bound vectors, and an
         // 'findex' vector.
-        dReal *rhs_tmp = memarena->AllocateArray<dReal>((size_t)nb * RHS__MAX);
+        dReal *rhs_tmp = memarena->AllocateArray<dReal>((sizeint)nb * RHS__MAX);
 
         dxQuickStepperStage2CallContext *stage2CallContext = (dxQuickStepperStage2CallContext*)memarena->AllocateBlock(sizeof(dxQuickStepperStage2CallContext));
         stage2CallContext->Initialize(callContext, localContext, rhs_tmp);
@@ -1443,7 +1443,7 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext *stage2CallContex
             const unsigned ofsi = mindex[ji].mIndex;
             const unsigned int infom = mindex[ji + 1].mIndex - ofsi;
 
-            dReal *const JRow = J + (size_t)ofsi * JME__MAX;
+            dReal *const JRow = J + (sizeint)ofsi * JME__MAX;
             {
                 dReal *const JEnd = JRow + infom * JME__MAX;
                 for (dReal *JCurr = JRow; JCurr != JEnd; JCurr += JME__MAX) {
@@ -1488,7 +1488,7 @@ void dxQuickStepIsland_Stage2a(dxQuickStepperStage2CallContext *stage2CallContex
                 // for joints, that requested feedback (which is normally much less)
                 unsigned mfbCount = mindex[ji + 1].fbIndex - mindex[ji].fbIndex;
                 if (mfbCount != 0) {
-                    dReal *const JEnd = JRow + (size_t)mfbCount * JME__MAX;
+                    dReal *const JEnd = JRow + (sizeint)mfbCount * JME__MAX;
                     for (const dReal *JCurr = JRow; ; ) {
                         for (unsigned i = 0; i != JME__J1_COUNT; ++i) { JCopy[i + JCE__J1_MIN] = JCurr[i + JME__J1_MIN]; }
                         for (unsigned j = 0; j != JME__J2_COUNT; ++j) { JCopy[j + JCE__J2_MIN] = JCurr[j + JME__J2_MIN]; }
@@ -1591,8 +1591,8 @@ void dxQuickStepIsland_Stage2b(dxQuickStepperStage2CallContext *stage2CallContex
             unsigned int bi = bi_step * step_size;
             const unsigned int biend = bi + dMIN(step_size, nb - bi);
 
-            dReal *rhscurr = rhs_tmp + (size_t)bi * RHS__MAX;
-            const dReal *invIrow = invI + (size_t)bi * IIE__MAX;
+            dReal *rhscurr = rhs_tmp + (sizeint)bi * RHS__MAX;
+            const dReal *invIrow = invI + (sizeint)bi * IIE__MAX;
             while (true) {
                 dxBody *b = body[bi];
                 dReal body_invMass = b->invMass;
@@ -1700,8 +1700,8 @@ void dxQuickStepIsland_Stage3(dxQuickStepperStage3CallContext *stage3CallContext
         dReal *lambda = memarena->AllocateArray<dReal>(m);
 
         unsigned int nb = callContext->m_islandBodiesCount;
-        dReal *cforce = memarena->AllocateArray<dReal>((size_t)nb * CFE__MAX);
-        dReal *iMJ = memarena->AllocateOveralignedArray<dReal>((size_t)m * IMJ__MAX, INVMJ_ALIGNMENT);
+        dReal *cforce = memarena->AllocateArray<dReal>((sizeint)nb * CFE__MAX);
+        dReal *iMJ = memarena->AllocateOveralignedArray<dReal>((sizeint)m * IMJ__MAX, INVMJ_ALIGNMENT);
         // order to solve constraint rows in
         IndexError *order = memarena->AllocateArray<IndexError>(m);
         dReal *last_lambda = NULL;
@@ -1719,7 +1719,7 @@ void dxQuickStepIsland_Stage3(dxQuickStepperStage3CallContext *stage3CallContext
         atomicord32 *mi_links = NULL;
 #if !dTHREADING_INTF_DISABLED
         bi_links_or_mi_levels = memarena->AllocateArray<atomicord32>(dMAX(nb, m));
-        mi_links = memarena->AllocateArray<atomicord32>(2 * ((size_t)m + 1));
+        mi_links = memarena->AllocateArray<atomicord32>(2 * ((sizeint)m + 1));
 #else
         dIASSERT(singleThreadedExecution);
 #endif
@@ -2066,7 +2066,7 @@ void dxQuickStepIsland_Stage4LCP_MTfcComputation_cold(dxQuickStepperStage4CallCo
     while ((bi_step = ThrsafeIncrementIntUpToLimit(&stage4CallContext->m_mi_fc, nb_steps)) != nb_steps) {
         unsigned int bi = bi_step * step_size;
         unsigned int bicnt = dMIN(step_size, nb - bi);
-        dSetZero(fc + (size_t)bi * CFE__MAX, (size_t)bicnt * CFE__MAX);
+        dSetZero(fc + (sizeint)bi * CFE__MAX, (sizeint)bicnt * CFE__MAX);
     }
 }
 
@@ -2095,7 +2095,7 @@ void dxQuickStepIsland_Stage4LCP_STfcComputation(dxQuickStepperStage4CallContext
     const dxStepperProcessingCallContext *callContext = stage4CallContext->m_stepperCallContext;
     unsigned int nb = callContext->m_islandBodiesCount;
 
-    dSetZero(fc, (size_t)nb * CFE__MAX);
+    dSetZero(fc, (sizeint)nb * CFE__MAX);
 #endif
 
 }
@@ -2134,8 +2134,8 @@ void dxQuickStepIsland_Stage4LCP_AdComputation(dxQuickStepperStage4CallContext *
         unsigned int mi = mi_step * step_size;
         const unsigned int miend = mi + dMIN(step_size, m - mi);
 
-        const dReal *iMJ_ptr = iMJ + (size_t)mi * IMJ__MAX;
-        dReal *J_ptr = J + (size_t)mi * JME__MAX;
+        const dReal *iMJ_ptr = iMJ + (sizeint)mi * IMJ__MAX;
+        dReal *J_ptr = J + (sizeint)mi * JME__MAX;
         while (true) {
             dReal sum = REAL(0.0);
             {
@@ -2505,9 +2505,9 @@ void dxQuickStepIsland_Stage4LCP_DependencyMapForNewOrderRebuilding(dxQuickStepp
         // Check that the dependency targets an earlier "i"
         dIASSERT(encoded_depi < encioded_i);
 
-        unsigned encoded_downi = mi_links[(size_t)encoded_depi * 2 + 1];
-        mi_links[(size_t)encoded_depi * 2 + 1] = encioded_i; // Link i as down-dependency for depi
-        mi_links[(size_t)encioded_i * 2] = encoded_downi; // Link previous down-chain as the level-dependency with i
+        unsigned encoded_downi = mi_links[(sizeint)encoded_depi * 2 + 1];
+        mi_links[(sizeint)encoded_depi * 2 + 1] = encioded_i; // Link i as down-dependency for depi
+        mi_links[(sizeint)encioded_i * 2] = encoded_downi; // Link previous down-chain as the level-dependency with i
     }
 }
 
@@ -2522,10 +2522,10 @@ void dxQuickStepIsland_Stage4LCP_DependencyMapFromSavedLevelsReconstruction(dxQu
     unsigned int m = localContext->m_m;
     for (unsigned int i = 0; i != m; ++i) {
         unsigned int currentLevelRoot = mi_levels[i];
-        unsigned int currentLevelFirstLink = mi_links[2 * (size_t)currentLevelRoot + 1];
+        unsigned int currentLevelFirstLink = mi_links[2 * (sizeint)currentLevelRoot + 1];
         unsigned int encoded_i = dxENCODE_INDEX(i);
-        mi_links[2 * (size_t)currentLevelRoot + 1] = encoded_i;
-        mi_links[2 * (size_t)encoded_i + 0] = currentLevelFirstLink;
+        mi_links[2 * (sizeint)currentLevelRoot + 1] = encoded_i;
+        mi_links[2 * (sizeint)encoded_i + 0] = currentLevelFirstLink;
     }
 
     // Additionally reset available level root's list head
@@ -2582,29 +2582,29 @@ void dxQuickStepIsland_Stage4LCP_MTIteration(dxQuickStepperStage4CallContext *st
             break;
         }
         
-        for (unsigned int currentLevelRoot = initialLevelRoot; ; currentLevelRoot = mi_links[2 * (size_t)currentLevelRoot + 0]) {
+        for (unsigned int currentLevelRoot = initialLevelRoot; ; currentLevelRoot = mi_links[2 * (sizeint)currentLevelRoot + 0]) {
             while (true) {
                 const unsigned invalid_link = dxENCODE_INDEX(-1);
 
-                unsigned currentLevelFirstLink = mi_links[2 * (size_t)currentLevelRoot + 1];
+                unsigned currentLevelFirstLink = mi_links[2 * (sizeint)currentLevelRoot + 1];
                 if (currentLevelFirstLink == invalid_link) {
                     break;
                 }
                 
                 // Try to extract first record from linked list
-                unsigned currentLevelNextLink = mi_links[2 * (size_t)currentLevelFirstLink + 0];
-                if (ThrsafeCompareExchange(&mi_links[2 * (size_t)currentLevelRoot + 1], currentLevelFirstLink, currentLevelNextLink)) {
+                unsigned currentLevelNextLink = mi_links[2 * (sizeint)currentLevelFirstLink + 0];
+                if (ThrsafeCompareExchange(&mi_links[2 * (sizeint)currentLevelRoot + 1], currentLevelFirstLink, currentLevelNextLink)) {
                     // if succeeded, execute selected iteration step...
                     dxQuickStepIsland_Stage4LCP_IterationStep(stage4CallContext, dxDECODE_INDEX(currentLevelFirstLink));
 
                     // Check if there are any dependencies
-                    unsigned level0DownLink = mi_links[2 * (size_t)currentLevelFirstLink + 1];
+                    unsigned level0DownLink = mi_links[2 * (sizeint)currentLevelFirstLink + 1];
                     if (level0DownLink != invalid_link) {
                         // ...and if yes, insert the record into the list of available level roots
                         unsigned int levelRootsFirst;
                         do {
                             levelRootsFirst = mi_links[2 * dxHEAD_INDEX + 0];
-                            mi_links[2 * (size_t)currentLevelFirstLink + 0] = levelRootsFirst;
+                            mi_links[2 * (sizeint)currentLevelFirstLink + 0] = levelRootsFirst;
                         }
                         while (!ThrsafeCompareExchange(&mi_links[2 * dxHEAD_INDEX + 0], levelRootsFirst, currentLevelFirstLink));
 
@@ -2693,7 +2693,7 @@ void dxQuickStepIsland_Stage4LCP_IterationStep(dxQuickStepperStage4CallContext *
     dReal old_lambda = lambda[index];
 
     dReal *J = localContext->m_J;
-    const dReal *J_ptr = J + (size_t)index * JME__MAX;
+    const dReal *J_ptr = J + (sizeint)index * JME__MAX;
 
     {
         delta = J_ptr[JME_RHS] - old_lambda * J_ptr[JME_CFM];
@@ -2705,14 +2705,14 @@ void dxQuickStepIsland_Stage4LCP_IterationStep(dxQuickStepperStage4CallContext *
         int b1 = jb[index].first;
 
         // @@@ potential optimization: SIMD-ize this and the b2 >= 0 case
-        fc_ptr1 = fc + (size_t)(unsigned)b1 * CFE__MAX;
+        fc_ptr1 = fc + (sizeint)(unsigned)b1 * CFE__MAX;
         delta -= fc_ptr1[CFE_LX] * J_ptr[JME_J1LX] + fc_ptr1[CFE_LY] * J_ptr[JME_J1LY] +
             fc_ptr1[CFE_LZ] * J_ptr[JME_J1LZ] + fc_ptr1[CFE_AX] * J_ptr[JME_J1AX] +
             fc_ptr1[CFE_AY] * J_ptr[JME_J1AY] + fc_ptr1[CFE_AZ] * J_ptr[JME_J1AZ];
         // @@@ potential optimization: handle 1-body constraints in a separate
         //     loop to avoid the cost of test & jump?
         if (b2 != -1) {
-            fc_ptr2 = fc + (size_t)(unsigned)b2 * CFE__MAX;
+            fc_ptr2 = fc + (sizeint)(unsigned)b2 * CFE__MAX;
             delta -= fc_ptr2[CFE_LX] * J_ptr[JME_J2LX] + fc_ptr2[CFE_LY] * J_ptr[JME_J2LY] +
                 fc_ptr2[CFE_LZ] * J_ptr[JME_J2LZ] + fc_ptr2[CFE_AX] * J_ptr[JME_J2AX] +
                 fc_ptr2[CFE_AY] * J_ptr[JME_J2AY] + fc_ptr2[CFE_AZ] * J_ptr[JME_J2AZ];
@@ -2761,7 +2761,7 @@ void dxQuickStepIsland_Stage4LCP_IterationStep(dxQuickStepperStage4CallContext *
 
     {
         dReal *iMJ = stage4CallContext->m_iMJ;
-        const dReal *iMJ_ptr = iMJ + (size_t)index * IMJ__MAX;
+        const dReal *iMJ_ptr = iMJ + (sizeint)index * IMJ__MAX;
         // update fc.
         // @@@ potential optimization: SIMD for this and the b2 >= 0 case
         fc_ptr1[CFE_LX] += delta * iMJ_ptr[IMJ_1LX];
@@ -2871,7 +2871,7 @@ void dxQuickStepIsland_Stage4b(dxQuickStepperStage4CallContext *stage4CallContex
         while ((ji_step = ThrsafeIncrementIntUpToLimit(&stage4CallContext->m_ji_4b, nj_steps)) != nj_steps) {
             unsigned int ji = ji_step * step_size;
             const dReal *lambdacurr = lambda + mindex[ji].mIndex;
-            const dReal *Jcopycurr = Jcopy + (size_t)mindex[ji].fbIndex * JCE__MAX;
+            const dReal *Jcopycurr = Jcopy + (sizeint)mindex[ji].fbIndex * JCE__MAX;
             const dJointWithInfo1 *jicurr = jointinfos + ji;
             const dJointWithInfo1 *const jiend = jicurr + dMIN(step_size, nj - ji);
 
@@ -3005,7 +3005,7 @@ void dxQuickStepIsland_Stage6a(dxQuickStepperStage6CallContext *stage6CallContex
         unsigned int bi = bi_step * step_size;
         unsigned int bicnt = dMIN(step_size, nb - bi);
 
-        const dReal *invIrow = invI + (size_t)bi * IIE__MAX;
+        const dReal *invIrow = invI + (sizeint)bi * IIE__MAX;
         dxBody *const *bodycurr = body + bi;
         dxBody *const *bodyend = bodycurr + bicnt;
         while (true) {
@@ -3132,7 +3132,7 @@ void dxQuickStepIsland_Stage6b(dxQuickStepperStage6CallContext *stage6CallContex
 
 
 /*extern */
-size_t dxEstimateQuickStepMemoryRequirements (dxBody * const *body,
+sizeint dxEstimateQuickStepMemoryRequirements (dxBody * const *body,
                                               unsigned int nb,
                                               dxJoint * const *_joint,
                                               unsigned int _nj)
@@ -3160,14 +3160,14 @@ size_t dxEstimateQuickStepMemoryRequirements (dxBody * const *body,
         nj = njcurr; m = mcurr; mfb = mfbcurr;
     }
 
-    size_t res = 0;
+    sizeint res = 0;
 
     res += dOVERALIGNED_SIZE(sizeof(dReal) * IIE__MAX * nb, INVI_ALIGNMENT); // for invI
 
     {
-        size_t sub1_res1 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * _nj); // for initial jointinfos
+        sizeint sub1_res1 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * _nj); // for initial jointinfos
 
-        size_t sub1_res2 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * nj); // for shrunk jointinfos
+        sizeint sub1_res2 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * nj); // for shrunk jointinfos
         sub1_res2 += dEFFICIENT_SIZE(sizeof(dxQuickStepperLocalContext)); // for dxQuickStepLocalContext
         if (m > 0) {
             sub1_res2 += dEFFICIENT_SIZE(sizeof(dxMIndexItem) * (nj + 1)); // for mindex
@@ -3176,13 +3176,13 @@ size_t dxEstimateQuickStepMemoryRequirements (dxBody * const *body,
             sub1_res2 += dOVERALIGNED_SIZE(sizeof(dReal) * JME__MAX * m, JACOBIAN_ALIGNMENT); // for J
             sub1_res2 += dOVERALIGNED_SIZE(sizeof(dReal) * JCE__MAX * mfb, JCOPY_ALIGNMENT); // for Jcopy
             {
-                size_t sub2_res1 = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage3CallContext)); // for dxQuickStepperStage3CallContext
+                sizeint sub2_res1 = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage3CallContext)); // for dxQuickStepperStage3CallContext
                 sub2_res1 += dEFFICIENT_SIZE(sizeof(dReal) * RHS__MAX * nb); // for rhs_tmp
                 sub2_res1 += dEFFICIENT_SIZE(sizeof(dxQuickStepperStage2CallContext)); // for dxQuickStepperStage2CallContext
 
-                size_t sub2_res2 = 0;
+                sizeint sub2_res2 = 0;
                 {
-                    size_t sub3_res1 = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage5CallContext)); // for dxQuickStepperStage5CallContext;
+                    sizeint sub3_res1 = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage5CallContext)); // for dxQuickStepperStage5CallContext;
                     sub3_res1 += dEFFICIENT_SIZE(sizeof(dReal) * m); // for lambda
                     sub3_res1 += dEFFICIENT_SIZE(sizeof(dReal) * CFE__MAX * nb); // for cforce
                     sub3_res1 += dOVERALIGNED_SIZE(sizeof(dReal) * IMJ__MAX * m, INVMJ_ALIGNMENT); // for iMJ
@@ -3192,11 +3192,11 @@ size_t dxEstimateQuickStepMemoryRequirements (dxBody * const *body,
 #endif
 #if !dTHREADING_INTF_DISABLED
                     sub3_res1 += dEFFICIENT_SIZE(sizeof(atomicord32) * dMAX(nb, m)); // for bi_links_or_mi_levels
-                    sub3_res1 += dEFFICIENT_SIZE(sizeof(atomicord32) * 2 * ((size_t)m + 1)); // for mi_links
+                    sub3_res1 += dEFFICIENT_SIZE(sizeof(atomicord32) * 2 * ((sizeint)m + 1)); // for mi_links
 #endif
                     sub3_res1 += dEFFICIENT_SIZE(sizeof(dxQuickStepperStage4CallContext)); // for dxQuickStepperStage4CallContext;
 
-                    size_t sub3_res2 = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage6CallContext)); // for dxQuickStepperStage6CallContext;
+                    sizeint sub3_res2 = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage6CallContext)); // for dxQuickStepperStage6CallContext;
                     
                     sub2_res2 += dMAX(sub3_res1, sub3_res2);
                 }
@@ -3208,8 +3208,8 @@ size_t dxEstimateQuickStepMemoryRequirements (dxBody * const *body,
             sub1_res2 += dEFFICIENT_SIZE(sizeof(dxQuickStepperStage3CallContext)); // for dxQuickStepperStage3CallContext
         }
 
-        size_t sub1_res12_max = dMAX(sub1_res1, sub1_res2);
-        size_t stage01_contexts = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage0BodiesCallContext))
+        sizeint sub1_res12_max = dMAX(sub1_res1, sub1_res2);
+        sizeint stage01_contexts = dEFFICIENT_SIZE(sizeof(dxQuickStepperStage0BodiesCallContext))
             + dEFFICIENT_SIZE(sizeof(dxQuickStepperStage0JointsCallContext))
             + dEFFICIENT_SIZE(sizeof(dxQuickStepperStage1CallContext));
         res += dMAX(sub1_res12_max, stage01_contexts);

+ 1 - 1
ode/src/quickstep.h

@@ -28,7 +28,7 @@
 struct dxStepperProcessingCallContext;
 
 
-size_t dxEstimateQuickStepMemoryRequirements(
+sizeint dxEstimateQuickStepMemoryRequirements(
     dxBody * const *body, unsigned int nb, dxJoint * const *_joint, unsigned int _nj);
 unsigned dxEstimateQuickStepMaxCallCount(
     unsigned activeThreadCount, unsigned allowedThreadCount);

+ 1 - 1
ode/src/resource_control.cpp

@@ -59,7 +59,7 @@ bool dxRequiredResourceContainer::allocateResources(const dxResourceRequirementD
 
     do
     {
-        size_t memorySizeRequirement = requirementDescriptor.getMemorySizeRequirement();
+        sizeint memorySizeRequirement = requirementDescriptor.getMemorySizeRequirement();
         
         if (memorySizeRequirement != 0)
         {

+ 4 - 4
ode/src/resource_control.h

@@ -68,7 +68,7 @@ public:
         mergeAnotherDescriptorIn(anotherDescriptor.m_memorySizeRequirement, anotherDescriptor.m_memoryAlignmentRequirement, anotherDescriptor.m_simultaneousCallRequirement, allOtherFeatureFlags);
     }
 
-    void mergeAnotherDescriptorIn(size_t memorySizeRequirement/*=0*/, unsigned memoryAlignmentRequirement,
+    void mergeAnotherDescriptorIn(sizeint memorySizeRequirement/*=0*/, unsigned memoryAlignmentRequirement,
         unsigned simultaneousCallRequirement/*=0*/, unsigned featureRequirement/*=0*/)
     {
         m_memorySizeRequirement = dMACRO_MAX(m_memorySizeRequirement, memorySizeRequirement);
@@ -79,7 +79,7 @@ public:
 
 public:
     dxThreadingBase *getrelatedThreading() const { return m_relatedThreading; }
-    size_t getMemorySizeRequirement() const { return m_memorySizeRequirement; }
+    sizeint getMemorySizeRequirement() const { return m_memorySizeRequirement; }
     unsigned getMemoryAlignmentRequirement() const { return m_memoryAlignmentRequirement; }
 
     unsigned getSimultaneousCallRequirement() const { return m_simultaneousCallRequirement; }
@@ -99,7 +99,7 @@ private:
 
 private:
     dxThreadingBase     *m_relatedThreading;
-    size_t              m_memorySizeRequirement;
+    sizeint              m_memorySizeRequirement;
     unsigned            m_memoryAlignmentRequirement;
     unsigned            m_simultaneousCallRequirement;
     CSimpleFlags        m_featureRequirements;
@@ -133,7 +133,7 @@ public:
     dxThreadingBase *getThreadingInstance() const { return m_relatedThreading; }
     dCallWaitID getStockCallWait() const { return m_stockCallWait; }
     void *getMemoryBufferPointer() const { return m_memoryAllocation.getUserAreaPointer(); }
-    size_t getMemoryBufferSize() const { return m_memoryAllocation.getUserAreaSize(); }
+    sizeint getMemoryBufferSize() const { return m_memoryAllocation.getUserAreaSize(); }
 
 private:
     dxThreadingBase     *m_relatedThreading;

+ 56 - 56
ode/src/step.cpp

@@ -202,8 +202,8 @@ enum dxContactForceElement
 
 struct dxStepperStage0Outputs
 {
-    size_t                          ji_start;
-    size_t                          ji_end;
+    sizeint                         ji_start;
+    sizeint                         ji_end;
     unsigned int                    m;
     unsigned int                    nub;
 };
@@ -519,10 +519,10 @@ void dxStepIsland(const dxStepperProcessingCallContext *callContext)
     unsigned int nb = callContext->m_islandBodiesCount;
     unsigned int _nj = callContext->m_islandJointsCount;
 
-    dReal *invI = memarena->AllocateOveralignedArray<dReal>(dM3E__MAX * (size_t)nb, INVI_ALIGNMENT);
+    dReal *invI = memarena->AllocateOveralignedArray<dReal>(dM3E__MAX * (sizeint)nb, INVI_ALIGNMENT);
     // Reserve twice as much memory and start from the middle so that regardless of 
     // what direction the array grows to there would be sufficient room available.
-    const size_t ji_reserve_count = 2 * (size_t)_nj;
+    const sizeint ji_reserve_count = 2 * (sizeint)_nj;
     dJointWithInfo1 *const jointinfos = memarena->AllocateArray<dJointWithInfo1>(ji_reserve_count);
 
     const unsigned allowedThreads = callContext->m_stepperAllowedThreads;
@@ -740,10 +740,10 @@ void dxStepIsland_Stage0_Joints(dxStepperStage0JointsCallContext *callContext)
     // also number all active joints in the joint list (set their tag values).
     // inactive joints receive a tag value of -1.
 
-    size_t ji_start, ji_end;
+    sizeint ji_start, ji_end;
     {
         unsigned int mcurr = 0;
-        size_t unb_start, mix_start, mix_end, lcp_end;
+        sizeint unb_start, mix_start, mix_end, lcp_end;
         unb_start = mix_start = mix_end = lcp_end = _nj;
 
         dJointWithInfo1 *jicurr = jointinfos + lcp_end;
@@ -861,7 +861,7 @@ void dxStepIsland_Stage0_Joints(dxStepperStage0JointsCallContext *callContext)
 
         callContext->m_stage0Outputs->m = mcurr;
         callContext->m_stage0Outputs->nub = (unsigned)(mix_start - unb_start);
-        dIASSERT((size_t)(mix_start - unb_start) <= (size_t)UINT_MAX);
+        dIASSERT((sizeint)(mix_start - unb_start) <= (sizeint)UINT_MAX);
         ji_start = unb_start;
         ji_end = lcp_end;
     }
@@ -894,8 +894,8 @@ void dxStepIsland_Stage1(dxStepperStage1CallContext *stage1CallContext)
     const dxStepperProcessingCallContext *callContext = stage1CallContext->m_stepperCallContext;
     dJointWithInfo1 *_jointinfos = stage1CallContext->m_jointinfos;
     dReal *invI = stage1CallContext->m_invI;
-    size_t ji_start = stage1CallContext->m_stage0Outputs.ji_start;
-    size_t ji_end = stage1CallContext->m_stage0Outputs.ji_end;
+    sizeint ji_start = stage1CallContext->m_stage0Outputs.ji_start;
+    sizeint ji_end = stage1CallContext->m_stage0Outputs.ji_end;
     unsigned int m = stage1CallContext->m_stage0Outputs.m;
     unsigned int nub = stage1CallContext->m_stage0Outputs.nub;
 
@@ -906,13 +906,13 @@ void dxStepIsland_Stage1(dxStepperStage1CallContext *stage1CallContext)
         dIVERIFY(stage1CallContext == NULL); // To suppress compiler warnings about unused variable assignment
 
         unsigned int _nj = callContext->m_islandJointsCount;
-        const size_t ji_reserve_count = 2 * (size_t)_nj;
+        const sizeint ji_reserve_count = 2 * (sizeint)_nj;
         memarena->ShrinkArray<dJointWithInfo1>(_jointinfos, ji_reserve_count, ji_end);
     }
 
     dJointWithInfo1 *jointinfos = _jointinfos + ji_start;
     unsigned int nj = (unsigned int)(ji_end - ji_start);
-    dIASSERT((size_t)(ji_end - ji_start) <= (size_t)UINT_MAX);
+    dIASSERT((sizeint)(ji_end - ji_start) <= (sizeint)UINT_MAX);
 
     unsigned int *mindex = NULL;
     dReal *J = NULL, *A = NULL, *pairsRhsCfm = NULL, *pairsLoHi = NULL;
@@ -921,7 +921,7 @@ void dxStepIsland_Stage1(dxStepperStage1CallContext *stage1CallContext)
 
     // if there are constraints, compute constrForce
     if (m > 0) {
-        mindex = memarena->AllocateArray<unsigned int>((size_t)(nj + 1));
+        mindex = memarena->AllocateArray<unsigned int>((sizeint)(nj + 1));
         {
             unsigned int *mcurr = mindex;
             unsigned int moffs = 0;
@@ -941,14 +941,14 @@ void dxStepIsland_Stage1(dxStepperStage1CallContext *stage1CallContext)
         // force mixing vector `cfm', and LCP low and high bound vectors, and an
         // 'findex' vector.
         findex = memarena->AllocateArray<int>(m);
-        J = memarena->AllocateArray<dReal>((size_t)m * (2 * JME__MAX));
-        A = memarena->AllocateOveralignedArray<dReal>((size_t)m * dPAD(m), AMATRIX_ALIGNMENT);
-        pairsRhsCfm = memarena->AllocateArray<dReal>((size_t)m * RCE__RHS_CFM_MAX);
-        pairsLoHi = memarena->AllocateArray<dReal>((size_t)m * LHE__LO_HI_MAX);
+        J = memarena->AllocateArray<dReal>((sizeint)m * (2 * JME__MAX));
+        A = memarena->AllocateOveralignedArray<dReal>((sizeint)m * dPAD(m), AMATRIX_ALIGNMENT);
+        pairsRhsCfm = memarena->AllocateArray<dReal>((sizeint)m * RCE__RHS_CFM_MAX);
+        pairsLoHi = memarena->AllocateArray<dReal>((sizeint)m * LHE__LO_HI_MAX);
         const unsigned int nb = callContext->m_islandBodiesCount;
         bodyStartJoints = memarena->AllocateArray<atomicord32>(nb);
-        bodyJointLinks = memarena->AllocateArray<atomicord32>((size_t)nj * dJCB__MAX);
-        dICHECK(nj < ~((atomicord32)0) / dJCB__MAX); // If larger joint counts are to be used, pointers (or size_t) need to be stored rather than atomicord32 indices
+        bodyJointLinks = memarena->AllocateArray<atomicord32>((sizeint)nj * dJCB__MAX);
+        dICHECK(nj < ~((atomicord32)0) / dJCB__MAX); // If larger joint counts are to be used, pointers (or sizeint) need to be stored rather than atomicord32 indices
     }
 
     dxStepperLocalContext *localContext = (dxStepperLocalContext *)memarena->AllocateBlock(sizeof(dxStepperLocalContext));
@@ -959,9 +959,9 @@ void dxStepIsland_Stage1(dxStepperStage1CallContext *stage1CallContext)
     stage3CallContext->Initialize(callContext, localContext, stage1MemarenaState);
 
     if (m > 0) {
-        dReal *JinvM = memarena->AllocateOveralignedArray<dReal>((size_t)m * (2 * JIM__MAX), JINVM_ALIGNMENT);
+        dReal *JinvM = memarena->AllocateOveralignedArray<dReal>((sizeint)m * (2 * JIM__MAX), JINVM_ALIGNMENT);
         const unsigned int nb = callContext->m_islandBodiesCount;
-        dReal *rhs_tmp = memarena->AllocateArray<dReal>((size_t)nb * dDA__MAX);
+        dReal *rhs_tmp = memarena->AllocateArray<dReal>((sizeint)nb * dDA__MAX);
 
         dxStepperStage2CallContext *stage2CallContext = (dxStepperStage2CallContext *)memarena->AllocateBlock(sizeof(dxStepperStage2CallContext));
         stage2CallContext->Initialize(callContext, localContext, JinvM, rhs_tmp);
@@ -1059,9 +1059,9 @@ void dxStepIsland_Stage2a(dxStepperStage2CallContext *stage2CallContext)
             const unsigned ofsi = mindex[ji];
             const unsigned int infom = mindex[ji + 1] - ofsi;
 
-            dReal *const JRow = J + (size_t)ofsi * (2 * JME__MAX);
-            dReal *rowRhsCfm = pairsRhsCfm + (size_t)ofsi * RCE__RHS_CFM_MAX;
-            dReal *rowLoHi = pairsLoHi + (size_t)ofsi * LHE__LO_HI_MAX;
+            dReal *const JRow = J + (sizeint)ofsi * (2 * JME__MAX);
+            dReal *rowRhsCfm = pairsRhsCfm + (sizeint)ofsi * RCE__RHS_CFM_MAX;
+            dReal *rowLoHi = pairsLoHi + (sizeint)ofsi * LHE__LO_HI_MAX;
             {
                 dSetZero (JRow, infom * (2 * JME__MAX));
 
@@ -1160,10 +1160,10 @@ void dxStepIsland_Stage2b(dxStepperStage2CallContext *stage2CallContext)
             const unsigned ofsi = mindex[ji];
             const unsigned int infom = mindex[ji + 1] - ofsi;
 
-            dReal *Arow = A + (size_t)mskip * ofsi;
-            dSetZero(Arow, (size_t)mskip * infom);
+            dReal *Arow = A + (sizeint)mskip * ofsi;
+            dSetZero(Arow, (sizeint)mskip * infom);
             dReal *Adiag = Arow + ofsi;
-            const dReal *rowRfsCrm = pairsRhsCfm + (size_t)ofsi * RCE__RHS_CFM_MAX;
+            const dReal *rowRfsCrm = pairsRhsCfm + (sizeint)ofsi * RCE__RHS_CFM_MAX;
             for (unsigned int i = 0; i != infom; Adiag += mskip, ++i) {
                 Adiag[i] = (rowRfsCrm + i * RCE__RHS_CFM_MAX)[RCE_CFM];
             }
@@ -1188,16 +1188,16 @@ void dxStepIsland_Stage2b(dxStepperStage2CallContext *stage2CallContext)
             const unsigned ofsi = mindex[ji];
             const unsigned int infom = mindex[ji + 1] - ofsi;
 
-            dReal *Jdst = JinvM + (size_t)ofsi * (2 * JIM__MAX);
+            dReal *Jdst = JinvM + (sizeint)ofsi * (2 * JIM__MAX);
             dSetZero(Jdst, infom * (2 * JIM__MAX));
 
-            const dReal *Jsrc = J + (size_t)ofsi * (2 * JME__MAX);
+            const dReal *Jsrc = J + (sizeint)ofsi * (2 * JME__MAX);
             dxJoint *joint = jointinfos[ji].joint;
 
             dxBody *jb0 = joint->node[0].body;
             if (true || jb0 != NULL) { // -- always true
                 dReal body_invMass0 = jb0->invMass;
-                const dReal *body_invI0 = invI + (size_t)(unsigned int)jb0->tag * dM3E__MAX;
+                const dReal *body_invI0 = invI + (sizeint)(unsigned int)jb0->tag * dM3E__MAX;
                 for (unsigned int j = infom; j != 0; --j) {
                     for (unsigned int k = dSA__MIN; k != dSA__MAX; ++k) Jdst[JIM__L_AXES_MIN + k] = Jsrc[JME__JL_MIN + k] * body_invMass0;
                     dMultiply0_133(Jdst + JIM__A_AXES_MIN, Jsrc + JME__JA_MIN, body_invI0);
@@ -1209,7 +1209,7 @@ void dxStepIsland_Stage2b(dxStepperStage2CallContext *stage2CallContext)
             dxBody *jb1 = joint->node[1].body;
             if (jb1 != NULL) {
                 dReal body_invMass1 = jb1->invMass;
-                const dReal *body_invI1 = invI + (size_t)(unsigned int)jb1->tag * dM3E__MAX;
+                const dReal *body_invI1 = invI + (sizeint)(unsigned int)jb1->tag * dM3E__MAX;
                 for (unsigned int j = infom; j != 0; --j) {
                     for (unsigned int k = dSA__MIN; k != dSA__MAX; ++k) Jdst[JIM__L_AXES_MIN + k] = Jsrc[JME__JL_MIN + k] * body_invMass1;
                     dMultiply0_133 (Jdst + JIM__A_AXES_MIN, Jsrc + JME__JA_MIN, body_invI1);
@@ -1239,8 +1239,8 @@ void dxStepIsland_Stage2b(dxStepperStage2CallContext *stage2CallContext)
         // put v/h + invM*fe into rhs_tmp
         unsigned bi;
         while ((bi = ThrsafeIncrementIntUpToLimit(&stage2CallContext->m_bi_rhs_tmp, nb)) != nb) {
-            dReal *tmp1curr = rhs_tmp + (size_t)bi * dDA__MAX;
-            const dReal *invIrow = invI + (size_t)bi * dM3E__MAX;
+            dReal *tmp1curr = rhs_tmp + (sizeint)bi * dDA__MAX;
+            const dReal *invIrow = invI + (sizeint)bi * dM3E__MAX;
             dxBody *b = body[bi];
             // dSetZero(tmp1curr, 8); -- not needed
             for (unsigned int j = dSA__MIN; j != dSA__MAX; ++j) tmp1curr[dDA__L_MIN + j] = b->facc[dV3E__AXES_MIN + j] * b->invMass + b->lvel[dV3E__AXES_MIN + j] * stepsizeRecip;
@@ -1311,14 +1311,14 @@ void dxStepIsland_Stage2c(dxStepperStage2CallContext *stage2CallContext)
             const unsigned ofsi = mindex[ji];
             const unsigned int infom = mindex[ji + 1] - ofsi;
 
-            dReal *Arow = A + (size_t)mskip * ofsi;
-            const dReal *JinvMRow = JinvM + (size_t)ofsi * (2 * JIM__MAX);
+            dReal *Arow = A + (sizeint)mskip * ofsi;
+            const dReal *JinvMRow = JinvM + (sizeint)ofsi * (2 * JIM__MAX);
             dxJoint *joint = jointinfos[ji].joint;
 
             dxBody *jb0 = joint->node[0].body;
             if (true || jb0 != NULL) { // -- always true
                 // compute diagonal block of A
-                const dReal *JRow = J + (size_t)ofsi * (2 * JME__MAX);
+                const dReal *JRow = J + (sizeint)ofsi * (2 * JME__MAX);
                 MultiplyAddJinvMxJToA (Arow + ofsi, JinvMRow, JRow, infom, infom, mskip);
 
                 for (dxJointNode *n0 = (ji != 0 ? jb0->firstjoint : NULL); n0; n0 = n0->next) {
@@ -1331,7 +1331,7 @@ void dxStepIsland_Stage2c(dxStepperStage2CallContext *stage2CallContext)
                         const dJointWithInfo1 *jiother = jointinfos + j0;
                         unsigned int smart_infom = (jiother->joint->node[1].body == jb0) ? jiother_infom : 0;
                         // set block of A
-                        const dReal *JOther = J + ((size_t)jiother_ofsi * 2 + smart_infom) * JME__MAX;
+                        const dReal *JOther = J + ((sizeint)jiother_ofsi * 2 + smart_infom) * JME__MAX;
                         MultiplyAddJinvMxJToA (Arow + jiother_ofsi, JinvMRow, JOther, infom, jiother_infom, mskip);
                     }
                 }
@@ -1342,7 +1342,7 @@ void dxStepIsland_Stage2c(dxStepperStage2CallContext *stage2CallContext)
             if (jb1 != NULL) {
                 const dReal *JinvMOther = JinvMRow + infom * JIM__MAX;
                 // compute diagonal block of A
-                const dReal *JRow = J + ((size_t)ofsi * 2 + infom) * JME__MAX;
+                const dReal *JRow = J + ((sizeint)ofsi * 2 + infom) * JME__MAX;
                 MultiplyAddJinvMxJToA (Arow + ofsi, JinvMOther, JRow, infom, infom, mskip);
 
                 for (dxJointNode *n1 = (ji != 0 ? jb1->firstjoint : NULL); n1; n1 = n1->next) {
@@ -1355,7 +1355,7 @@ void dxStepIsland_Stage2c(dxStepperStage2CallContext *stage2CallContext)
                         const dJointWithInfo1 *jiother = jointinfos + j1;
                         unsigned int smart_infom = (jiother->joint->node[1].body == jb1) ? jiother_infom : 0;
                         // set block of A
-                        const dReal *JOther = J + ((size_t)jiother_ofsi * 2 + smart_infom) * JME__MAX;
+                        const dReal *JOther = J + ((sizeint)jiother_ofsi * 2 + smart_infom) * JME__MAX;
                         MultiplyAddJinvMxJToA (Arow + jiother_ofsi, JinvMOther, JOther, infom, jiother_infom, mskip);
                     }
                 }
@@ -1382,18 +1382,18 @@ void dxStepIsland_Stage2c(dxStepperStage2CallContext *stage2CallContext)
             const unsigned ofsi = mindex[ji];
             const unsigned int infom = mindex[ji + 1] - ofsi;
 
-            dReal *currRhsCfm = pairsRhsCfm + (size_t)ofsi * RCE__RHS_CFM_MAX;
-            const dReal *JRow = J + (size_t)ofsi * (2 * JME__MAX);
+            dReal *currRhsCfm = pairsRhsCfm + (sizeint)ofsi * RCE__RHS_CFM_MAX;
+            const dReal *JRow = J + (sizeint)ofsi * (2 * JME__MAX);
             
             dxJoint *joint = jointinfos[ji].joint;
 
             dxBody *jb0 = joint->node[0].body;
             if (true || jb0 != NULL) { // -- always true
                 unsigned bodyIndex = (unsigned)jb0->tag;
-                MultiplySubJxRhsTmpFromRHS (currRhsCfm, JRow, rhs_tmp + (size_t)bodyIndex * dDA__MAX, infom);
+                MultiplySubJxRhsTmpFromRHS (currRhsCfm, JRow, rhs_tmp + (sizeint)bodyIndex * dDA__MAX, infom);
 
                 // Link joints connected to each body into a list to be used on results incorporation. The bodyStartJoints have been initialized in dxStepIsland_Stage2b.
-                const atomicord32 linkIndex = (atomicord32)((size_t)ji * dJCB__MAX + dJCB_FIRST_BODY); // It is asserted at links buffer allocation that the indices can't overflow atomicord32
+                const atomicord32 linkIndex = (atomicord32)((sizeint)ji * dJCB__MAX + dJCB_FIRST_BODY); // It is asserted at links buffer allocation that the indices can't overflow atomicord32
                 for (atomicord32 oldStartIndex = bodyStartJoints[bodyIndex]; ; oldStartIndex = bodyStartJoints[bodyIndex]) {
                     bodyJointLinks[linkIndex] = oldStartIndex;
                     if (ThrsafeCompareExchange(&bodyStartJoints[bodyIndex], oldStartIndex, linkIndex + 1)) { // The link index is stored incremented to allow 0 as end indicator
@@ -1405,10 +1405,10 @@ void dxStepIsland_Stage2c(dxStepperStage2CallContext *stage2CallContext)
             dxBody *jb1 = joint->node[1].body;
             if (jb1 != NULL) {
                 unsigned bodyIndex = (unsigned)jb1->tag;
-                MultiplySubJxRhsTmpFromRHS (currRhsCfm, JRow + infom * JME__MAX, rhs_tmp + (size_t)bodyIndex * dDA__MAX, infom);
+                MultiplySubJxRhsTmpFromRHS (currRhsCfm, JRow + infom * JME__MAX, rhs_tmp + (sizeint)bodyIndex * dDA__MAX, infom);
 
                 // Link joints connected to each body into a list to be used on results incorporation. The bodyStartJoints have been initialized in dxStepIsland_Stage2b
-                const atomicord32 linkIndex = (atomicord32)((size_t)ji * dJCB__MAX + dJCB_SECOND_BODY); // It is asserted at links buffer allocation that the indices can't overflow atomicord32
+                const atomicord32 linkIndex = (atomicord32)((sizeint)ji * dJCB__MAX + dJCB_SECOND_BODY); // It is asserted at links buffer allocation that the indices can't overflow atomicord32
                 for (atomicord32 oldStartIndex = bodyStartJoints[bodyIndex]; ; oldStartIndex = bodyStartJoints[bodyIndex]) {
                     bodyJointLinks[linkIndex] = oldStartIndex;
                     if (ThrsafeCompareExchange(&bodyStartJoints[bodyIndex], oldStartIndex, linkIndex + 1)) { // The link index is stored incremented to allow 0 as end indicator
@@ -1521,7 +1521,7 @@ void dxStepIsland_Stage4(dxStepperStage4CallContext *stage4CallContext)
     while ((bi = ThrsafeIncrementIntUpToLimit(&stage4CallContext->m_bi_constrForce, nb)) != nb) {
         dVector3 angularForceAccumulator;
         dxBody *b = bodies[bi];
-        const dReal *invIrow = invI + (size_t)bi * dM3E__MAX;
+        const dReal *invIrow = invI + (sizeint)bi * dM3E__MAX;
         dReal body_invMass_mul_stepSize = stepSize * b->invMass;
 
         dReal bodyConstrForce[CFE__MAX];
@@ -1541,8 +1541,8 @@ void dxStepIsland_Stage4(dxStepperStage4CallContext *stage4CallContext)
             unsigned ofsi = mIndex[jointIndex];
             dIASSERT(dIN_RANGE(jointIndex, 0, localContext->m_nj));
 
-            const dReal *JRow = J + (size_t)ofsi * (2 * JME__MAX);
-            const dReal *rowRhsLambda = pairsRhsLambda + (size_t)ofsi * RLE__RHS_LAMBDA_MAX;
+            const dReal *JRow = J + (sizeint)ofsi * (2 * JME__MAX);
+            const dReal *rowRhsLambda = pairsRhsLambda + (sizeint)ofsi * RLE__RHS_LAMBDA_MAX;
 
             dxJoint *joint = currJointInfo->joint;
             const unsigned int infom = currJointInfo->info.m;
@@ -1587,7 +1587,7 @@ void dxStepIsland_Stage4(dxStepperStage4CallContext *stage4CallContext)
 //****************************************************************************
 
 /*extern */
-size_t dxEstimateStepMemoryRequirements (dxBody * const *body, unsigned int nb, dxJoint * const *_joint, unsigned int _nj)
+sizeint dxEstimateStepMemoryRequirements (dxBody * const *body, unsigned int nb, dxJoint * const *_joint, unsigned int _nj)
 {
     (void)body; // unused
     unsigned int nj, m;
@@ -1610,15 +1610,15 @@ size_t dxEstimateStepMemoryRequirements (dxBody * const *body, unsigned int nb,
         nj = njcurr; m = mcurr;
     }
 
-    size_t res = 0;
+    sizeint res = 0;
 
     res += dOVERALIGNED_SIZE(sizeof(dReal) * dM3E__MAX * nb, INVI_ALIGNMENT); // for invI
 
     {
-        size_t sub1_res1 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * 2 * _nj); // for initial jointinfos
+        sizeint sub1_res1 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * 2 * _nj); // for initial jointinfos
 
         // The array can't grow right more than by nj
-        size_t sub1_res2 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * ((size_t)_nj + (size_t)nj)); // for shrunk jointinfos
+        sizeint sub1_res2 = dEFFICIENT_SIZE(sizeof(dJointWithInfo1) * ((sizeint)_nj + (sizeint)nj)); // for shrunk jointinfos
         sub1_res2 += dEFFICIENT_SIZE(sizeof(dxStepperLocalContext)); //for dxStepperLocalContext
         if (m > 0) {
             sub1_res2 += dEFFICIENT_SIZE(sizeof(unsigned int) * (nj + 1)); // for mindex
@@ -1633,11 +1633,11 @@ size_t dxEstimateStepMemoryRequirements (dxBody * const *body, unsigned int nb,
         }
 
         {
-            size_t sub2_res1 = dEFFICIENT_SIZE(sizeof(dxStepperStage3CallContext)); // for dxStepperStage3CallContext
+            sizeint sub2_res1 = dEFFICIENT_SIZE(sizeof(dxStepperStage3CallContext)); // for dxStepperStage3CallContext
 
-            size_t sub2_res2 = 0;
+            sizeint sub2_res2 = 0;
 
-            size_t sub2_res3 = dEFFICIENT_SIZE(sizeof(dxStepperStage4CallContext)); // for dxStepperStage4CallContext
+            sizeint sub2_res3 = dEFFICIENT_SIZE(sizeof(dxStepperStage4CallContext)); // for dxStepperStage4CallContext
 
             if (m > 0) {
                 sub2_res1 += dOVERALIGNED_SIZE(sizeof(dReal) * 2 * JIM__MAX * m, JINVM_ALIGNMENT); // for JinvM
@@ -1650,8 +1650,8 @@ size_t dxEstimateStepMemoryRequirements (dxBody * const *body, unsigned int nb,
             sub1_res2 += dMAX(sub2_res1, dMAX(sub2_res2, sub2_res3));
         }
 
-        size_t sub1_res12_max = dMAX(sub1_res1, sub1_res2);
-        size_t stage01_contexts = dEFFICIENT_SIZE(sizeof(dxStepperStage0BodiesCallContext))
+        sizeint sub1_res12_max = dMAX(sub1_res1, sub1_res2);
+        sizeint stage01_contexts = dEFFICIENT_SIZE(sizeof(dxStepperStage0BodiesCallContext))
             + dEFFICIENT_SIZE(sizeof(dxStepperStage0JointsCallContext))
             + dEFFICIENT_SIZE(sizeof(dxStepperStage1CallContext));
         res += dMAX(sub1_res12_max, stage01_contexts);

+ 1 - 1
ode/src/step.h

@@ -28,7 +28,7 @@
 struct dxStepperProcessingCallContext;
 
 
-size_t dxEstimateStepMemoryRequirements(
+sizeint dxEstimateStepMemoryRequirements(
     dxBody * const *body, unsigned int nb, dxJoint * const *_joint, unsigned int _nj);
 unsigned dxEstimateStepMaxCallCount(
     unsigned activeThreadCount, unsigned allowedThreadCount);

+ 21 - 21
ode/src/threaded_solver_ldlt.h

@@ -111,14 +111,14 @@ private:
 
     struct FactorizationSolvingL1StripeMemoryEstimates
     {
-        void assignData(size_t descriptorSizeRequired, size_t contextSizeRequired)
+        void assignData(sizeint descriptorSizeRequired, sizeint contextSizeRequired)
         {
             m_descriptorSizeRequired = descriptorSizeRequired;
             m_contextSizeRequired = contextSizeRequired;
         }
 
-        size_t  m_descriptorSizeRequired;
-        size_t  m_contextSizeRequired;
+        sizeint  m_descriptorSizeRequired;
+        sizeint  m_contextSizeRequired;
     };
 
     static unsigned deriveSolvingL1StripeThreadCount(unsigned blockCount, unsigned allowedThreadCount)
@@ -129,14 +129,14 @@ private:
         return maximumCount >= allowedThreadCount ? allowedThreadCount : dMACRO_MAX(maximumCount, 1U);
     }
 
-    static size_t estimateCooperativelySolvingL1Stripe_XMemoryRequirement(unsigned blockCount, 
+    static sizeint estimateCooperativelySolvingL1Stripe_XMemoryRequirement(unsigned blockCount, 
         FactorizationSolvingL1StripeMemoryEstimates &ref_memoryEstimates)
     {
-        size_t descriptorSizeRequired = dOVERALIGNED_SIZE(sizeof(cellindexint) * blockCount, COOP_THREAD_DATA_ALIGNMENT_SIZE);
-        size_t contextSizeRequired = dOVERALIGNED_SIZE(sizeof(FactorizationSolveL1StripeCellContext) * (CCI__MAX + 1) * blockCount, COOP_THREAD_DATA_ALIGNMENT_SIZE);
+        sizeint descriptorSizeRequired = dOVERALIGNED_SIZE(sizeof(cellindexint) * blockCount, COOP_THREAD_DATA_ALIGNMENT_SIZE);
+        sizeint contextSizeRequired = dOVERALIGNED_SIZE(sizeof(FactorizationSolveL1StripeCellContext) * (CCI__MAX + 1) * blockCount, COOP_THREAD_DATA_ALIGNMENT_SIZE);
         ref_memoryEstimates.assignData(descriptorSizeRequired, contextSizeRequired);
 
-        size_t totalSizeRequired = descriptorSizeRequired + contextSizeRequired;
+        sizeint totalSizeRequired = descriptorSizeRequired + contextSizeRequired;
         return totalSizeRequired;
     }
 
@@ -196,23 +196,23 @@ private:
 
     struct FactorizationScalingAndFactorizingL1StripeMemoryEstimates
     {
-        void assignData(size_t contextSizeRequired)
+        void assignData(sizeint contextSizeRequired)
         {
             m_contextSizeRequired = contextSizeRequired;
         }
 
-        size_t  m_contextSizeRequired;
+        sizeint  m_contextSizeRequired;
     };
 
-    static size_t estimateCooperativelyScalingAndFactorizingL1Stripe_XMemoryRequirement(unsigned factorizingMaximumThreads, 
+    static sizeint estimateCooperativelyScalingAndFactorizingL1Stripe_XMemoryRequirement(unsigned factorizingMaximumThreads, 
         FactorizationScalingAndFactorizingL1StripeMemoryEstimates &ref_memoryEstimates)
     {
         dIASSERT(factorizingMaximumThreads != 0);
 
-        size_t contextSizeRequired = dOVERALIGNED_SIZE(sizeof(FactorizationFactorizeL1StripeContext) + sizeof(FactorizationFactorizeL1StripeThreadContext) * (factorizingMaximumThreads - 1), COOP_THREAD_DATA_ALIGNMENT_SIZE);
+        sizeint contextSizeRequired = dOVERALIGNED_SIZE(sizeof(FactorizationFactorizeL1StripeContext) + sizeof(FactorizationFactorizeL1StripeThreadContext) * (factorizingMaximumThreads - 1), COOP_THREAD_DATA_ALIGNMENT_SIZE);
         ref_memoryEstimates.assignData(contextSizeRequired);
 
-        size_t totalSizeRequired = contextSizeRequired;
+        sizeint totalSizeRequired = contextSizeRequired;
         return totalSizeRequired;
     }
 
@@ -470,14 +470,14 @@ private:
 
     struct SolvingL1StraightMemoryEstimates
     {
-        void assignData(size_t descriptorSizeRequired, size_t contextSizeRequired)
+        void assignData(sizeint descriptorSizeRequired, sizeint contextSizeRequired)
         {
             m_descriptorSizeRequired = descriptorSizeRequired;
             m_contextSizeRequired = contextSizeRequired;
         }
 
-        size_t  m_descriptorSizeRequired;
-        size_t  m_contextSizeRequired;
+        sizeint  m_descriptorSizeRequired;
+        sizeint  m_contextSizeRequired;
     };
 
     static unsigned deriveSolvingL1StraightThreadCount(unsigned blockCount, unsigned allowedThreadCount)
@@ -489,7 +489,7 @@ private:
     }
 
     template<unsigned int block_step>
-    static size_t estimateCooperativelySolvingL1StraightMemoryRequirement(unsigned rowCount, SolvingL1StraightMemoryEstimates &ref_solvingMemoryEstimates);
+    static sizeint estimateCooperativelySolvingL1StraightMemoryRequirement(unsigned rowCount, SolvingL1StraightMemoryEstimates &ref_solvingMemoryEstimates);
 
     static void *markCooperativelySolvingL1StraightMemoryStructuresOut(void *buffer, 
         const SolvingL1StraightMemoryEstimates &solvingMemoryEstimates, 
@@ -606,14 +606,14 @@ private:
 
     struct SolvingL1TransposedMemoryEstimates
     {
-        void assignData(size_t descriptorSizeRequired, size_t contextSizeRequired)
+        void assignData(sizeint descriptorSizeRequired, sizeint contextSizeRequired)
         {
             m_descriptorSizeRequired = descriptorSizeRequired;
             m_contextSizeRequired = contextSizeRequired;
         }
 
-        size_t  m_descriptorSizeRequired;
-        size_t  m_contextSizeRequired;
+        sizeint  m_descriptorSizeRequired;
+        sizeint  m_contextSizeRequired;
     };
 
     static unsigned deriveSolvingL1TransposedThreadCount(unsigned blockCount, unsigned allowedThreadCount)
@@ -624,7 +624,7 @@ private:
     }
 
     template<unsigned int block_step>
-    static size_t estimateCooperativelySolvingL1TransposedMemoryRequirement(unsigned rowCount, SolvingL1TransposedMemoryEstimates &ref_solvingMemoryEstimates);
+    static sizeint estimateCooperativelySolvingL1TransposedMemoryRequirement(unsigned rowCount, SolvingL1TransposedMemoryEstimates &ref_solvingMemoryEstimates);
 
     static void *markCooperativelySolvingL1TransposedMemoryStructuresOut(void *buffer, 
         const SolvingL1TransposedMemoryEstimates &solvingMemoryEstimates, 
@@ -638,7 +638,7 @@ private:
     }
 
     template<unsigned int block_step>
-    static void *allocateCooperativelySolveL1TransposedMemoryStructures(size_t &out_sizeAllocated, unsigned rowCount, 
+    static void *allocateCooperativelySolveL1TransposedMemoryStructures(sizeint &out_sizeAllocated, unsigned rowCount, 
         cellindexint *&out_blockProgressDescriptors, SolveL1TransposedCellContext *&out_cellContexts);
     template<unsigned int block_step>
     static void initializeCooperativelySolveL1TransposedMemoryStructures(unsigned rowCount, 

+ 10 - 10
ode/src/threading_atomics_provs.h

@@ -68,7 +68,7 @@ public:
     }
 
     template<unsigned type_size>
-    static size_t AddValueToTarget(volatile void *value_accumulator_ptr, ptrdiff_t value_addend);
+    static sizeint AddValueToTarget(volatile void *value_accumulator_ptr, diffint value_addend);
 
     static bool CompareExchangeTargetPtr(volatile atomicptr_t *pointer_storage_ptr, 
         atomicptr_t comparand_value, atomicptr_t new_value)
@@ -89,7 +89,7 @@ public:
 };
 
 template<>
-inline size_t dxFakeAtomicsProvider::AddValueToTarget<sizeof(dxFakeAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, ptrdiff_t value_addend)
+inline sizeint dxFakeAtomicsProvider::AddValueToTarget<sizeof(dxFakeAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, diffint value_addend)
 {
     atomicord_t original_value = *(volatile atomicord_t *)value_accumulator_ptr;
 
@@ -99,13 +99,13 @@ inline size_t dxFakeAtomicsProvider::AddValueToTarget<sizeof(dxFakeAtomicsProvid
 }
 
 template<>
-inline size_t dxFakeAtomicsProvider::AddValueToTarget<2 * sizeof(dxFakeAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, ptrdiff_t value_addend)
+inline sizeint dxFakeAtomicsProvider::AddValueToTarget<2 * sizeof(dxFakeAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, diffint value_addend)
 {
     atomicptr_t original_value = *(volatile atomicptr_t *)value_accumulator_ptr;
 
-    *(volatile atomicptr_t *)value_accumulator_ptr = (atomicptr_t)((size_t)original_value + (size_t)value_addend);
+    *(volatile atomicptr_t *)value_accumulator_ptr = (atomicptr_t)((sizeint)original_value + (sizeint)value_addend);
 
-    return (size_t)original_value;
+    return (sizeint)original_value;
 }
 
 
@@ -153,7 +153,7 @@ public:
     }
 
     template<unsigned type_size>
-    static size_t AddValueToTarget(volatile void *value_accumulator_ptr, ptrdiff_t value_addend);
+    static sizeint AddValueToTarget(volatile void *value_accumulator_ptr, diffint value_addend);
 
     static bool CompareExchangeTargetPtr(volatile atomicptr_t *pointer_storage_ptr, 
         atomicptr_t comparand_value, atomicptr_t new_value)
@@ -163,13 +163,13 @@ public:
 };
 
 template<>
-inline size_t dxOUAtomicsProvider::AddValueToTarget<sizeof(dxOUAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, ptrdiff_t value_addend)
+inline sizeint dxOUAtomicsProvider::AddValueToTarget<sizeof(dxOUAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, diffint value_addend)
 {
     return _OU_NAMESPACE::AtomicExchangeAdd((volatile atomicord_t *)value_accumulator_ptr, (atomicord_t)value_addend);
 }
 
 template<>
-inline size_t dxOUAtomicsProvider::AddValueToTarget<2 * sizeof(dxOUAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, ptrdiff_t value_addend)
+inline sizeint dxOUAtomicsProvider::AddValueToTarget<2 * sizeof(dxOUAtomicsProvider::atomicord_t)>(volatile void *value_accumulator_ptr, diffint value_addend)
 {
     atomicptr_t original_value;
 
@@ -177,14 +177,14 @@ inline size_t dxOUAtomicsProvider::AddValueToTarget<2 * sizeof(dxOUAtomicsProvid
     {
         original_value = *(volatile atomicptr_t *)value_accumulator_ptr;
 
-        atomicptr_t new_value = (atomicptr_t)((size_t)original_value + (size_t)value_addend);
+        atomicptr_t new_value = (atomicptr_t)((sizeint)original_value + (sizeint)value_addend);
         if (_OU_NAMESPACE::AtomicCompareExchangePointer((volatile atomicptr_t *)value_accumulator_ptr, original_value, new_value))
         {
             break;
         }
     }
 
-    return (size_t)original_value;
+    return (sizeint)original_value;
 }
 
 

+ 4 - 4
ode/src/threading_impl_templates.h

@@ -514,8 +514,8 @@ template<class tThreadMutex>
 {
     dAASSERT(Mutex_count != 0);
 
-    const dxtemplateMutexGroup<tThreadMutex> *const dummy_group = (dxtemplateMutexGroup<tThreadMutex> *)(size_t)8;
-    const size_t size_requited = ((size_t)(&dummy_group->m_Mutex_array) - (size_t)dummy_group) + Mutex_count * sizeof(tThreadMutex);
+    const dxtemplateMutexGroup<tThreadMutex> *const dummy_group = (dxtemplateMutexGroup<tThreadMutex> *)(sizeint)8;
+    const sizeint size_requited = ((sizeint)(&dummy_group->m_Mutex_array) - (sizeint)dummy_group) + Mutex_count * sizeof(tThreadMutex);
     dxtemplateMutexGroup<tThreadMutex> *mutex_group = (dxtemplateMutexGroup<tThreadMutex> *)dAlloc(size_requited);
 
     if (mutex_group != NULL)
@@ -540,9 +540,9 @@ template<class tThreadMutex>
         dmutexindex_t Mutex_count = mutex_group->m_un.m_mutex_count;
         mutex_group->FinalizeMutexArray(Mutex_count);
 
-        const size_t anyting_not_zero = 2 * sizeof(size_t);
+        const sizeint anyting_not_zero = 2 * sizeof(sizeint);
         const dxtemplateMutexGroup<tThreadMutex> *const dummy_group = (dxtemplateMutexGroup<tThreadMutex> *)anyting_not_zero;
-        const size_t size_requited = ((size_t)(&dummy_group->m_Mutex_array) - (size_t)dummy_group) + Mutex_count * sizeof(tThreadMutex);
+        const sizeint size_requited = ((sizeint)(&dummy_group->m_Mutex_array) - (sizeint)dummy_group) + Mutex_count * sizeof(tThreadMutex);
         dFree((void *)mutex_group, size_requited);
     }
 }

+ 17 - 17
ode/src/threading_pool_posix.cpp

@@ -206,10 +206,10 @@ public:
     dxThreadPoolThreadInfo();
     ~dxThreadPoolThreadInfo();
 
-    bool Initialize(size_t stack_size, unsigned int ode_data_allocate_flags);
+    bool Initialize(sizeint stack_size, unsigned int ode_data_allocate_flags);
 
 private:
-    bool InitializeThreadAttributes(pthread_attr_t *thread_attr, size_t stack_size);
+    bool InitializeThreadAttributes(pthread_attr_t *thread_attr, sizeint stack_size);
     void FinalizeThreadAttributes(pthread_attr_t *thread_attr);
     bool WaitInitStatus();
 
@@ -277,7 +277,7 @@ dxThreadPoolThreadInfo::~dxThreadPoolThreadInfo()
 }
 
 
-bool dxThreadPoolThreadInfo::Initialize(size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadPoolThreadInfo::Initialize(sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     bool result = false;
 
@@ -352,7 +352,7 @@ bool dxThreadPoolThreadInfo::Initialize(size_t stack_size, unsigned int ode_data
     return result;
 }
 
-bool dxThreadPoolThreadInfo::InitializeThreadAttributes(pthread_attr_t *thread_attr, size_t stack_size)
+bool dxThreadPoolThreadInfo::InitializeThreadAttributes(pthread_attr_t *thread_attr, sizeint stack_size)
 {
     bool result = false;
 
@@ -408,7 +408,7 @@ bool dxThreadPoolThreadInfo::WaitInitStatus()
     bool acknowledgement_wait_result = m_acknowledgement_event.WaitInfinitely();
     dICHECK(acknowledgement_wait_result);
 
-    int error_code = (int)(size_t)m_command_param;
+    int error_code = (int)(sizeint)m_command_param;
 
     bool init_status = error_code == EOK ? true : ((errno = error_code), false);
     return init_status;
@@ -493,7 +493,7 @@ bool dxThreadPoolThreadInfo::DisableSignalHandlers()
 
 void dxThreadPoolThreadInfo::ReportInitStatus(bool init_result)
 {
-    m_command_param = (void *)(size_t)(init_result ? EOK : ((errno != EOK) ? errno : EFAULT));
+    m_command_param = (void *)(sizeint)(init_result ? EOK : ((errno != EOK) ? errno : EFAULT));
 
     m_acknowledgement_event.SetEvent();
 }
@@ -568,15 +568,15 @@ public:
     dxThreadingThreadPool();
     ~dxThreadingThreadPool();
 
-    bool InitializeThreads(size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags);
+    bool InitializeThreads(sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags);
 
 private:
     void FinalizeThreads();
 
-    bool InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags);
-    void FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count);
+    bool InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags);
+    void FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count);
 
-    bool InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, size_t stack_size, unsigned int ode_data_allocate_flags);
+    bool InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, sizeint stack_size, unsigned int ode_data_allocate_flags);
     void FinalizeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info);
 
 public:
@@ -585,7 +585,7 @@ public:
 
 private:
     dxThreadPoolThreadInfo  *m_thread_infos;
-    size_t                  m_thread_count;
+    sizeint                  m_thread_count;
     dxEventObject           m_ready_wait_event;
 };
 
@@ -603,7 +603,7 @@ dxThreadingThreadPool::~dxThreadingThreadPool()
 }
 
 
-bool dxThreadingThreadPool::InitializeThreads(size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadingThreadPool::InitializeThreads(sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     dIASSERT(m_thread_infos == NULL);
 
@@ -663,7 +663,7 @@ void dxThreadingThreadPool::FinalizeThreads()
     dxThreadPoolThreadInfo *thread_infos = m_thread_infos;
     if (thread_infos != NULL)
     {
-        size_t thread_count = m_thread_count;
+        sizeint thread_count = m_thread_count;
 
         FinalizeIndividualThreadInfos(thread_infos, thread_count);
         dFree(thread_infos, thread_count * sizeof(dxThreadPoolThreadInfo));
@@ -673,7 +673,7 @@ void dxThreadingThreadPool::FinalizeThreads()
 }
 
 
-bool dxThreadingThreadPool::InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadingThreadPool::InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     bool any_fault = false;
 
@@ -693,7 +693,7 @@ bool dxThreadingThreadPool::InitializeIndividualThreadInfos(dxThreadPoolThreadIn
     return result;
 }
 
-void dxThreadingThreadPool::FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count)
+void dxThreadingThreadPool::FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count)
 {
     dxThreadPoolThreadInfo *const infos_end = thread_infos + thread_count;
     for (dxThreadPoolThreadInfo *current_info = thread_infos; current_info != infos_end; ++current_info)
@@ -703,7 +703,7 @@ void dxThreadingThreadPool::FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo
 }
 
 
-bool dxThreadingThreadPool::InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadingThreadPool::InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     bool result = false;
 
@@ -758,7 +758,7 @@ void dxThreadingThreadPool::WaitIdleState()
 
 
 /*extern */dThreadingThreadPoolID dThreadingAllocateThreadPool(unsigned thread_count, 
-                                                               size_t stack_size, unsigned int ode_data_allocate_flags, void *reserved/*=NULL*/)
+                                                               sizeint stack_size, unsigned int ode_data_allocate_flags, void *reserved/*=NULL*/)
 {
     dAASSERT(thread_count != 0);
 

+ 16 - 16
ode/src/threading_pool_win.cpp

@@ -52,7 +52,7 @@
 
 #if dBUILTIN_THREADING_IMPL_ENABLED
 
-#define THREAD_STACK_MAX  ((size_t)(UINT_MAX - 1)) // The absolute maximum would be UINT_MAX but let it be a little bit less to avoid "Comparison is always false" warnings. ;)
+#define THREAD_STACK_MAX  ((sizeint)(UINT_MAX - 1)) // The absolute maximum would be UINT_MAX but let it be a little bit less to avoid "Comparison is always false" warnings. ;)
 
 
 struct dxEventObject
@@ -126,7 +126,7 @@ public:
     dxThreadPoolThreadInfo();
     ~dxThreadPoolThreadInfo();
 
-    bool Initialize(size_t stack_size, unsigned int ode_data_allocate_flags);
+    bool Initialize(sizeint stack_size, unsigned int ode_data_allocate_flags);
 
 private:
     bool WaitInitStatus();
@@ -192,7 +192,7 @@ dxThreadPoolThreadInfo::~dxThreadPoolThreadInfo()
 }
 
 
-bool dxThreadPoolThreadInfo::Initialize(size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadPoolThreadInfo::Initialize(sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     bool result = false;
 
@@ -277,7 +277,7 @@ bool dxThreadPoolThreadInfo::WaitInitStatus()
     bool acknowledgement_wait_result = m_acknowledgement_event.WaitInfinitely();
     dICHECK(acknowledgement_wait_result);
 
-    DWORD error_code = (DWORD)(size_t)m_command_param;
+    DWORD error_code = (DWORD)(sizeint)m_command_param;
 
     bool init_status = error_code == ERROR_SUCCESS ? true : (SetLastError(error_code), false);
     return init_status;
@@ -352,7 +352,7 @@ void dxThreadPoolThreadInfo::ThreadProcedure()
 void dxThreadPoolThreadInfo::ReportInitStatus(bool init_result)
 {
     DWORD error_code;
-    m_command_param = (void *)(size_t)(init_result ? ERROR_SUCCESS : ((error_code = GetLastError()) != ERROR_SUCCESS ? error_code : ERROR_INTERNAL_ERROR));
+    m_command_param = (void *)(sizeint)(init_result ? ERROR_SUCCESS : ((error_code = GetLastError()) != ERROR_SUCCESS ? error_code : ERROR_INTERNAL_ERROR));
 
     m_acknowledgement_event.SetEvent();
 }
@@ -427,15 +427,15 @@ public:
     dxThreadingThreadPool();
     ~dxThreadingThreadPool();
 
-    bool InitializeThreads(size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags);
+    bool InitializeThreads(sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags);
 
 private:
     void FinalizeThreads();
 
-    bool InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags);
-    void FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count);
+    bool InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags);
+    void FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count);
 
-    bool InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, size_t stack_size, unsigned int ode_data_allocate_flags);
+    bool InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, sizeint stack_size, unsigned int ode_data_allocate_flags);
     void FinalizeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info);
 
 public:
@@ -444,7 +444,7 @@ public:
 
 private:
     dxThreadPoolThreadInfo  *m_thread_infos;
-    size_t                  m_thread_count;
+    sizeint                  m_thread_count;
     dxEventObject           m_ready_wait_event;
 };
 
@@ -462,7 +462,7 @@ dxThreadingThreadPool::~dxThreadingThreadPool()
 }
 
 
-bool dxThreadingThreadPool::InitializeThreads(size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadingThreadPool::InitializeThreads(sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     dIASSERT(m_thread_infos == NULL);
 
@@ -522,7 +522,7 @@ void dxThreadingThreadPool::FinalizeThreads()
     dxThreadPoolThreadInfo *thread_infos = m_thread_infos;
     if (thread_infos != NULL)
     {
-        size_t thread_count = m_thread_count;
+        sizeint thread_count = m_thread_count;
 
         FinalizeIndividualThreadInfos(thread_infos, thread_count);
         dFree(thread_infos, thread_count * sizeof(dxThreadPoolThreadInfo));
@@ -532,7 +532,7 @@ void dxThreadingThreadPool::FinalizeThreads()
 }
 
 
-bool dxThreadingThreadPool::InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count, size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadingThreadPool::InitializeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count, sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     bool any_fault = false;
 
@@ -552,7 +552,7 @@ bool dxThreadingThreadPool::InitializeIndividualThreadInfos(dxThreadPoolThreadIn
     return result;
 }
 
-void dxThreadingThreadPool::FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, size_t thread_count)
+void dxThreadingThreadPool::FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo *thread_infos, sizeint thread_count)
 {
     dxThreadPoolThreadInfo *const infos_end = thread_infos + thread_count;
     for (dxThreadPoolThreadInfo *current_info = thread_infos; current_info != infos_end; ++current_info)
@@ -562,7 +562,7 @@ void dxThreadingThreadPool::FinalizeIndividualThreadInfos(dxThreadPoolThreadInfo
 }
 
 
-bool dxThreadingThreadPool::InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, size_t stack_size, unsigned int ode_data_allocate_flags)
+bool dxThreadingThreadPool::InitializeSingleThreadInfo(dxThreadPoolThreadInfo *thread_info, sizeint stack_size, unsigned int ode_data_allocate_flags)
 {
     bool result = false;
 
@@ -617,7 +617,7 @@ void dxThreadingThreadPool::WaitIdleState()
 
 
 /*extern */dThreadingThreadPoolID dThreadingAllocateThreadPool(unsigned thread_count, 
-                                                               size_t stack_size, unsigned int ode_data_allocate_flags, void *reserved/*=NULL*/)
+                                                               sizeint stack_size, unsigned int ode_data_allocate_flags, void *reserved/*=NULL*/)
 {
     dAASSERT(thread_count != 0);
 

+ 2 - 2
ode/src/threadingutils.h

@@ -134,9 +134,9 @@ unsigned int ThrsafeIncrementIntUpToLimit(volatile atomicord32 *storagePointer,
 }
 
 static inline 
-size_t ThrsafeIncrementSizeUpToLimit(volatile size_t *storagePointer, size_t limitValue)
+sizeint ThrsafeIncrementSizeUpToLimit(volatile sizeint *storagePointer, sizeint limitValue)
 {
-    size_t resultValue;
+    sizeint resultValue;
     while (true) {
         resultValue = *storagePointer;
         // The ">=" comparison is not required here at present ("==" could be used). 

+ 2 - 2
ode/src/timer.cpp

@@ -369,7 +369,7 @@ static void fprintDoubleWithPrefix (FILE *f, double a, const char *fmt)
 void dTimerReport (FILE *fout, int average)
 {
     int i;
-    size_t maxl;
+    sizeint maxl;
     double ccunit = 1.0/dTimerTicksPerSecond();
     fprintf (fout,"\nTimer Report (");
     fprintDoubleWithPrefix (fout,ccunit,"%.2f ");
@@ -379,7 +379,7 @@ void dTimerReport (FILE *fout, int average)
     // get maximum description length
     maxl = 0;
     for (i=0; i<num; i++) {
-        size_t l = strlen (event[i].description);
+        sizeint l = strlen (event[i].description);
         if (l > maxl) maxl = l;
     }
 

Some files were not shown because too many files changed in this diff