55 * See COPYING in top-level directory.
66****************************************************************************/
77
8+ #include <time.h>
9+ #include <stdlib.h>
810#include "private/autogen/config.h"
911#include "hwloc.h"
1012
11- #ifdef HWLOC_WIN_SYS
12- #include <windows.h>
13- #endif
14-
1513struct hwloc_distrib_level {
1614 hwloc_obj_type_t type ; // level type.
1715 unsigned depth ; // level depth.
18- size_t user_index ; // Index of this level as provided by user order.
19- size_t arity ; // Number of children of this level below parent.
20- size_t coord ; // The current level object index [0..arity[.
16+ unsigned user_index ; // Index of this level as provided by user order.
17+ unsigned arity ; // Number of children of this level below parent.
18+ unsigned coord ; // The current level object index [0..arity[.
2119 // Iteration order of this level objects. index[coord] give logical_index below parent.
22- size_t * index ;
20+ unsigned * index ;
2321};
2422
2523struct hwloc_distrib_iterator {
2624 hwloc_obj_t * roots ;
27- size_t n_roots ;
28- size_t root_coord ;
25+ unsigned n_roots ;
26+ unsigned root_coord ;
2927 struct hwloc_distrib_level * * levels ; // n_roots * n_levels
30- size_t n_levels ;
28+ unsigned n_levels ;
3129};
3230
33- static size_t * range (const size_t n ){
34- size_t i ,* r = malloc (n * sizeof (* r ));
31+ static unsigned * range (const unsigned n ){
32+ unsigned i ,* r = malloc (n * sizeof (* r ));
3533
3634 if (r == NULL )
3735 return NULL ;
@@ -40,17 +38,17 @@ static size_t* range(const size_t n){
4038 return r ;
4139}
4240
43- static size_t * reversed_range (const size_t n ){
44- size_t i ,* r = malloc (n * sizeof (* r ));
41+ static unsigned * reversed_range (const unsigned n ){
42+ unsigned i ,* r = malloc (n * sizeof (* r ));
4543
4644 if (r == NULL )
4745 return NULL ;
4846 for (i = 0 ; i < n ; i ++ ){ r [i ] = n - i - 1 ; }
4947 return r ;
5048}
5149
52- static size_t * shuffled_range (const size_t n ){
53- size_t i , * index , * ret , val ;
50+ static unsigned * shuffled_range (const unsigned n ){
51+ unsigned i , * index , * ret , val ;
5452
5553 if ((index = range (n )) == NULL )
5654 return NULL ;
@@ -95,10 +93,10 @@ static struct hwloc_distrib_level *
9593hwloc_distrib_root_levels (hwloc_topology_t topology ,
9694 const hwloc_obj_t root ,
9795 const hwloc_obj_type_t * types ,
98- const size_t n_types ,
96+ const unsigned n_types ,
9997 const unsigned long flags )
10098{
101- size_t i ;
99+ unsigned i ;
102100 struct hwloc_distrib_level * levels = malloc (n_types * sizeof (* levels ));
103101 if (levels == NULL )
104102 return NULL ;
@@ -124,7 +122,7 @@ hwloc_distrib_root_levels(hwloc_topology_t topology,
124122 hwloc_distrib_level_cmp_depth );
125123
126124 // Walk from top to bottom and set arity to the maximum arity below root field.
127- size_t arity ;
125+ unsigned arity ;
128126 hwloc_obj_t parent = root ;
129127
130128 for (i = 0 ; i < n_types ; i ++ ){
@@ -184,11 +182,11 @@ static void hwloc_distrib_destroy_level(struct hwloc_distrib_level *levels){
184182struct hwloc_distrib_iterator *
185183hwloc_distrib_build_iterator (hwloc_topology_t topology ,
186184 hwloc_obj_t * roots ,
187- const size_t n_roots ,
185+ const unsigned n_roots ,
188186 const hwloc_obj_type_t * levels ,
189- const size_t n_levels ,
187+ const unsigned n_levels ,
190188 const unsigned long flags ){
191- size_t i ;
189+ unsigned i ;
192190 struct hwloc_distrib_iterator * it = malloc (sizeof (* it ) +
193191 sizeof (* it -> levels ) * n_roots );
194192 if (it == NULL )
@@ -245,7 +243,7 @@ hwloc_distrib_iterator_scatter(hwloc_topology_t topology,
245243 const hwloc_obj_type_t type ,
246244 const unsigned long flags ){
247245
248- size_t i = 0 , n = 0 ;
246+ unsigned i = 0 , n = 0 ;
249247 hwloc_obj_t obj , root = hwloc_get_obj_by_depth (topology , 0 , 0 );
250248
251249 // Count depths with a non empty cpuset.
@@ -297,7 +295,7 @@ hwloc_distrib_iterator_scatter(hwloc_topology_t topology,
297295}
298296
299297void hwloc_distrib_destroy_iterator (struct hwloc_distrib_iterator * it ){
300- size_t i ;
298+ unsigned i ;
301299
302300 for (i = 0 ; i < it -> n_roots ; i ++ )
303301 hwloc_distrib_destroy_level (it -> levels [i ]);
@@ -340,10 +338,10 @@ int
340338hwloc_distrib_iterator_next (hwloc_topology_t topology ,
341339 struct hwloc_distrib_iterator * it ,
342340 hwloc_obj_t * next ){
343- size_t i ;
341+ unsigned i ;
344342 struct hwloc_distrib_level * levels = it -> levels [it -> root_coord ];
345343 hwloc_obj_t obj = it -> roots [it -> root_coord ];
346- size_t coord ;
344+ unsigned coord ;
347345
348346 // Sort by depth to walk objects at set coordinates.
349347 qsort (levels ,
0 commit comments