Commit ac229837 by Christian Kern

Fixed the buggy implementation of the id pool (did give out fewer elements as…

Fixed the buggy implementation of the id pool (did give out fewer elements as capacity, with repeated operations capacity was further reduced).
parent 5abeb065
......@@ -71,7 +71,7 @@ mtapi_uint_t embb_mtapi_id_pool_allocate(embb_mtapi_id_pool_t * that) {
/* acquire position to fetch id from */
mtapi_uint_t id_position = that->get_id_position;
that->get_id_position++;
if (that->capacity <= that->get_id_position) {
if (that->capacity < that->get_id_position) {
that->get_id_position = 0;
}
......@@ -97,7 +97,7 @@ void embb_mtapi_id_pool_deallocate(
/* acquire position to put id to */
mtapi_uint_t id_position = that->put_id_position;
that->put_id_position++;
if (that->capacity <= that->put_id_position) {
if (that->capacity < that->put_id_position) {
that->put_id_position = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment