Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00013 #ifndef HWLOC_BITMAP_H
00014 #define HWLOC_BITMAP_H
00015
00016 #include <hwloc/autogen/config.h>
00017 #include <assert.h>
00018
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00024
00045 typedef struct hwloc_bitmap_s * hwloc_bitmap_t;
00047 typedef const struct hwloc_bitmap_s * hwloc_const_bitmap_t;
00048
00049
00050
00051
00052
00053
00061 hwloc_bitmap_t hwloc_bitmap_alloc(void) ;
00062
00064 hwloc_bitmap_t hwloc_bitmap_alloc_full(void) ;
00065
00070 void hwloc_bitmap_free(hwloc_bitmap_t bitmap);
00071
00073 hwloc_bitmap_t hwloc_bitmap_dup(hwloc_const_bitmap_t bitmap) ;
00074
00076 void hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src);
00077
00078
00079
00080
00081
00082
00092 int hwloc_bitmap_snprintf(char * restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
00093
00096 int hwloc_bitmap_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
00097
00100 int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char * restrict string);
00101
00114 int hwloc_bitmap_taskset_snprintf(char * restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
00115
00118 int hwloc_bitmap_taskset_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
00119
00122 int hwloc_bitmap_taskset_sscanf(hwloc_bitmap_t bitmap, const char * restrict string);
00123
00124
00125
00126
00127
00128
00130 void hwloc_bitmap_zero(hwloc_bitmap_t bitmap);
00131
00133 void hwloc_bitmap_fill(hwloc_bitmap_t bitmap);
00134
00136 void hwloc_bitmap_only(hwloc_bitmap_t bitmap, unsigned id);
00137
00139 void hwloc_bitmap_allbut(hwloc_bitmap_t bitmap, unsigned id);
00140
00142 void hwloc_bitmap_from_ulong(hwloc_bitmap_t bitmap, unsigned long mask);
00143
00145 void hwloc_bitmap_from_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
00146
00147
00148
00149
00150
00151
00153 void hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id);
00154
00156 void hwloc_bitmap_set_range(hwloc_bitmap_t bitmap, unsigned begin, unsigned end);
00157
00159 void hwloc_bitmap_set_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
00160
00162 void hwloc_bitmap_clr(hwloc_bitmap_t bitmap, unsigned id);
00163
00165 void hwloc_bitmap_clr_range(hwloc_bitmap_t bitmap, unsigned begin, unsigned end);
00166
00173 void hwloc_bitmap_singlify(hwloc_bitmap_t bitmap);
00174
00175
00176
00177
00178
00179
00181 unsigned long hwloc_bitmap_to_ulong(hwloc_const_bitmap_t bitmap) ;
00182
00184 unsigned long hwloc_bitmap_to_ith_ulong(hwloc_const_bitmap_t bitmap, unsigned i) ;
00185
00187 int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id) ;
00188
00190 int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) ;
00191
00193 int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) ;
00194
00199 int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) ;
00200
00205 int hwloc_bitmap_next(hwloc_const_bitmap_t bitmap, unsigned prev) ;
00206
00211 int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) ;
00212
00218 int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) ;
00219
00231 #define hwloc_bitmap_foreach_begin(id, bitmap) \
00232 do { \
00233 assert(hwloc_bitmap_weight(bitmap) != -1); \
00234 for (id = hwloc_bitmap_first(bitmap); \
00235 (unsigned) id != (unsigned) -1; \
00236 id = hwloc_bitmap_next(bitmap, id)) { \
00237
00241 #define hwloc_bitmap_foreach_end() \
00242 } \
00243 } while (0)
00244
00245
00246
00247
00248
00249
00251 void hwloc_bitmap_or (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
00252
00254 void hwloc_bitmap_and (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
00255
00257 void hwloc_bitmap_andnot (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
00258
00260 void hwloc_bitmap_xor (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
00261
00263 void hwloc_bitmap_not (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap);
00264
00265
00266
00267
00268
00269
00271 int hwloc_bitmap_intersects (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) ;
00272
00274 int hwloc_bitmap_isincluded (hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) ;
00275
00277 int hwloc_bitmap_isequal (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) ;
00278
00284 int hwloc_bitmap_compare_first(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) ;
00285
00291 int hwloc_bitmap_compare(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) ;
00292
00296 #ifdef __cplusplus
00297 }
00298 #endif
00299
00300
00301 #endif