X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/aea9fab393c4680b1165fb8af70e28736c5dbd07..41c803093e7108f16bfb4cc7e2c41c52104c73c2:/src/xbt/setset_private.h diff --git a/src/xbt/setset_private.h b/src/xbt/setset_private.h index 1db97982d1..3099ed18d5 100644 --- a/src/xbt/setset_private.h +++ b/src/xbt/setset_private.h @@ -1,3 +1,10 @@ +/* Copyright (c) 2010, 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "xbt/base.h" #include "xbt/dict.h" #include "xbt/dynar.h" #include "xbt/setset.h" @@ -12,7 +19,6 @@ typedef struct s_xbt_setset_elm { typedef union u_xbt_setset_elm_entry { /* Information when the entry is being used */ struct { - unsigned int refcount; xbt_setset_elm_t obj; } info; /* Information when the entry is free */ @@ -22,48 +28,33 @@ typedef union u_xbt_setset_elm_entry { } u_xbt_setset_elm_entry_t, *xbt_setset_elm_entry_t; typedef struct s_xbt_setset_set { - xbt_setset_t setset; /* setset that contains this set */ - unsigned int elmcount; /* number of elements */ - unsigned int size; /* in integers */ - unsigned int *bitmap; /* the bit array */ + xbt_setset_t setset; /* setset that contains this set */ + unsigned int size; /* in integers */ + unsigned int *bitmap; /* the bit array */ } s_xbt_setset_set_t; typedef struct s_xbt_setset { - xbt_dynar_t elm_array; /* of s_xbt_setset_elm_entry_t, to find elements by index */ - xbt_fifo_t sets; /* of s_xbt_setset_set_t, memberships in actual sets of setset */ + xbt_dynar_t elm_array; /* of s_xbt_setset_elm_entry_t, to find elements by index */ + xbt_fifo_t sets; /* of s_xbt_setset_set_t, memberships in actual sets of setset */ } s_xbt_setset_t; typedef struct s_xbt_setset_cursor { - int idx; /* Actual postition of the cursor (bit number) */ - xbt_setset_set_t set; /* The set associated to the cursor */ + int idx; /* Actual postition of the cursor (bit number) */ + xbt_setset_set_t set; /* The set associated to the cursor */ } s_xbt_setset_cursor_t; /* Some internal functions */ -/* Add an object to the setset, this will calculate its index */ -xbt_setset_elm_entry_t _xbt_setset_elm_add(xbt_setset_t setset, void *obj); - -/* Remove from the setset the object stored at idx */ -void _xbt_setset_elm_remove(xbt_setset_t setset, unsigned long idx); - -/* Increase the refcount of an element */ -void _xbt_setset_elm_use(xbt_setset_t setset, unsigned long idx); +XBT_PRIVATE int bitcount(int); /* Get the object associated to a given index */ -void *_xbt_setset_idx_to_obj(xbt_setset_t setset, unsigned long idx); +XBT_PRIVATE void *_xbt_setset_idx_to_obj(xbt_setset_t setset, unsigned long idx); /* Check if the nth bit of an integer is set or not*/ -unsigned int _is_bit_set(unsigned int bit, unsigned int integer); +XBT_PRIVATE unsigned int _is_bit_set(unsigned int bit, unsigned int integer); /* Set the nth bit of an array of integers */ -void _set_bit(unsigned int bit, unsigned int *bitmap); +XBT_PRIVATE void _set_bit(unsigned int bit, unsigned int *bitmap); /* Unset the nth bit of an array of integers */ -void _unset_bit(unsigned int bit, unsigned int *bitmap); - - - - - - - +XBT_PRIVATE void _unset_bit(unsigned int bit, unsigned int *bitmap);