Minor fixes

This commit is contained in:
Leonardo committed 2020-05-12 16:04:40 -03:00
1 parent 51d7a58424
commit 13e3f6047b
4 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -337,7 +337,7 @@ static const char *cmc_string_fmt_heap = "struct %s<%s> "
\
_heap_->buffer[_heap_->count++] = value; \
\
if (PFX##_count(_heap_) > 1) \
if (_heap_->count > 1) \
{ \
PFX##_impl_float_up(_heap_, _heap_->count - 1); \
} \
+4 -4
View File
@@ -876,7 +876,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> "
{ \
/* If the cardinality of _set1_ is greater than that of _set2_ */ \
/* then it is safe to say that _set1_ can't be a subset of _set2_ */ \
if (PFX##_count(_set1_) > PFX##_count(_set2_)) \
if (_set1_->count > _set2_->count) \
return false; \
\
/* The empty set is a subset of all sets */ \
@@ -915,7 +915,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> "
/* If the cardinality of _set1_ is greater than or equal to that */ \
/* of _set2_, then it is safe to say that _set1_ can't be a proper */ \
/* subset of _set2_ */ \
if (PFX##_count(_set1_) >= PFX##_count(_set2_)) \
if (_set1_->count >= _set2_->count) \
return false; \
\
if (PFX##_empty(_set1_)) \
@@ -1145,7 +1145,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> "
return false; \
} \
\
if (steps == 0 || iter->index + steps >= PFX##_count(iter->target)) \
if (steps == 0 || iter->index + steps >= iter->target->count) \
return false; \
\
iter->index += steps; \
@@ -1183,7 +1183,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> "
/* given index */ \
bool PFX##_iter_go_to(struct SNAME##_iter *iter, size_t index) \
{ \
if (index >= PFX##_count(iter->target)) \
if (index >= iter->target->count) \
return false; \
\
if (iter->index > index) \
+1 -1
View File
@@ -166,7 +166,7 @@ _Bool h_insert(struct heap *_heap_, size_t value)
return 0;
}
_heap_->buffer[_heap_->count++] = value;
if (h_count(_heap_) > 1)
if (_heap_->count > 1)
{
h_impl_float_up(_heap_, _heap_->count - 1);
}
+4 -4
View File
@@ -585,7 +585,7 @@ struct treeset *ts_symmetric_difference(struct treeset *_set1_,
}
_Bool ts_is_subset(struct treeset *_set1_, struct treeset *_set2_)
{
if (ts_count(_set1_) > ts_count(_set2_))
if (_set1_->count > _set2_->count)
return 0;
if (ts_empty(_set1_))
return 1;
@@ -605,7 +605,7 @@ _Bool ts_is_superset(struct treeset *_set1_, struct treeset *_set2_)
}
_Bool ts_is_proper_subset(struct treeset *_set1_, struct treeset *_set2_)
{
if (ts_count(_set1_) >= ts_count(_set2_))
if (_set1_->count >= _set2_->count)
return 0;
if (ts_empty(_set1_))
{
@@ -767,7 +767,7 @@ _Bool ts_iter_advance(struct treeset_iter *iter, size_t steps)
iter->end = 1;
return 0;
}
if (steps == 0 || iter->index + steps >= ts_count(iter->target))
if (steps == 0 || iter->index + steps >= iter->target->count)
return 0;
iter->index += steps;
for (size_t i = 0; i < steps; i++)
@@ -792,7 +792,7 @@ _Bool ts_iter_rewind(struct treeset_iter *iter, size_t steps)
}
_Bool ts_iter_go_to(struct treeset_iter *iter, size_t index)
{
if (index >= ts_count(iter->target))
if (index >= iter->target->count)
return 0;
if (iter->index > index)
return ts_iter_rewind(iter, iter->index - index);