summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-10 11:48:47 +0200
committerTyge Løvset <[email protected]>2022-04-10 11:48:47 +0200
commit3c8792d9365c2d0ecf7d60bebc6bf1ae0e91b664 (patch)
tree2c950765a393478aa1c1bcac25f55b4395984083
parent51daf09029820be6762a7a1224dc256465be44e7 (diff)
downloadSTC-modified-3c8792d9365c2d0ecf7d60bebc6bf1ae0e91b664.tar.gz
STC-modified-3c8792d9365c2d0ecf7d60bebc6bf1ae0e91b664.zip
Parenthesized args in calls to i_cmp(x, y), i_eq(x, y) and i_hash(x, len) - can be defined as macro without parenthesized args.
-rw-r--r--include/stc/alt/clist.h6
-rw-r--r--include/stc/alt/csmap.h6
-rw-r--r--include/stc/carc.h6
-rw-r--r--include/stc/cbox.h6
-rw-r--r--include/stc/cdeq.h4
-rw-r--r--include/stc/clist.h8
-rw-r--r--include/stc/cmap.h6
-rw-r--r--include/stc/cpque.h6
-rw-r--r--include/stc/csmap.h8
-rw-r--r--include/stc/cvec.h6
10 files changed, 31 insertions, 31 deletions
diff --git a/include/stc/alt/clist.h b/include/stc/alt/clist.h
index fa4e9c80..7a4ede57 100644
--- a/include/stc/alt/clist.h
+++ b/include/stc/alt/clist.h
@@ -207,7 +207,7 @@ STC_API size_t _clist_count(const clist_VOID* self);
_cx_iter i = it1; \
for (_cx_memb(_next)(&i); i.ref != it2.ref; _cx_memb(_next)(&i)) { \
i_valraw r = i_valto(i.ref); \
- if (i_cmp(&r, &val) == 0) return it1; \
+ if (i_cmp((&r), (&val)) == 0) return it1; \
it1 = i; \
} \
it1.ref = NULL; return it1; \
@@ -243,7 +243,7 @@ STC_API size_t _clist_count(const clist_VOID* self);
while (prev) { \
node = prev->next; \
i_valraw r = i_valto(&node->value); \
- if (i_cmp(&r, &val) == 0) \
+ if (i_cmp((&r), (&val)) == 0) \
prev = _cx_memb(_erase_after_)(self, prev), ++n; \
else \
prev = (node == self->last ? NULL : node); \
@@ -283,7 +283,7 @@ STC_API size_t _clist_count(const clist_VOID* self);
_cx_memb(_sort_cmp_)(const void* x, const void* y) { \
i_valraw a = i_valto(&((_cx_node *) x)->value); \
i_valraw b = i_valto(&((_cx_node *) y)->value); \
- return i_cmp(&a, &b); \
+ return i_cmp((&a), (&b)); \
} \
\
STC_DEF void \
diff --git a/include/stc/alt/csmap.h b/include/stc/alt/csmap.h
index f7292819..948e878b 100644
--- a/include/stc/alt/csmap.h
+++ b/include/stc/alt/csmap.h
@@ -232,7 +232,7 @@ static csmap_SENTINEL_node _aatree_sentinel = {&_aatree_sentinel, &_aatree_senti
out->_top = 0; \
while (tn->level) { \
int c; _cx_rawkey rx = i_keyto(_i_keyref(&tn->value)); \
- if ((c = i_cmp(&rx, &rkey)) < 0) tn = tn->link[1]; \
+ if ((c = i_cmp((&rx), (&rkey))) < 0) tn = tn->link[1]; \
else if (c > 0) {out->_st[out->_top++] = tn; tn = tn->link[0]; } \
else {out->_tn = tn->link[1]; return (out->ref = &tn->value); } \
} \
@@ -296,7 +296,7 @@ static csmap_SENTINEL_node _aatree_sentinel = {&_aatree_sentinel, &_aatree_senti
while (tx->level) { \
up[top++] = tx; \
_cx_rawkey r = i_keyto(_i_keyref(&tx->value)); \
- if (!(c = i_cmp(&r, rkey))) {res->ref = &tx->value; return tn; } \
+ if (!(c = i_cmp((&r), rkey))) {res->ref = &tx->value; return tn; } \
tx = tx->link[(dir = (c < 0))]; \
} \
tn = c_alloc(_cx_node); \
@@ -326,7 +326,7 @@ static csmap_SENTINEL_node _aatree_sentinel = {&_aatree_sentinel, &_aatree_senti
if (tn->level == 0) \
return tn; \
_cx_rawkey raw = i_keyto(_i_keyref(&tn->value)); \
- _cx_node *tx; int c = i_cmp(&raw, rkey); \
+ _cx_node *tx; int c = i_cmp((&raw), rkey); \
if (c != 0) \
tn->link[c < 0] = _cx_memb(_erase_r_)(tn->link[c < 0], rkey, erased); \
else { \
diff --git a/include/stc/carc.h b/include/stc/carc.h
index a133b577..de78fe3b 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -176,7 +176,7 @@ _cx_memb(_value_hash)(const _cx_value* x, size_t n) {
return c_hash32(&x, 4);
#else
_cx_raw rx = i_valto(x);
- return i_hash(&rx, sizeof rx);
+ return i_hash((&rx), (sizeof rx));
#endif
}
@@ -186,7 +186,7 @@ _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) {
return c_default_cmp(&x, &y);
#else
_cx_raw rx = i_valto(x), ry = i_valto(y);
- return i_cmp(&rx, &ry);
+ return i_cmp((&rx), (&ry));
#endif
}
@@ -196,7 +196,7 @@ _cx_memb(_value_eq)(const _cx_value* x, const _cx_value* y) {
return x == y;
#else
_cx_raw rx = i_valto(x), ry = i_valto(y);
- return i_eq(&rx, &ry);
+ return i_eq((&rx), (&ry));
#endif
}
#undef _i_atomic_inc
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index 6d06c052..85d46a5e 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -149,7 +149,7 @@ _cx_memb(_value_hash)(const _cx_value* x, size_t n) {
return c_hash32(&x, 4);
#else
_cx_raw rx = i_valto(x);
- return i_hash(&rx, sizeof rx);
+ return i_hash((&rx), (sizeof rx));
#endif
}
@@ -159,7 +159,7 @@ _cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) {
return c_default_cmp(&x, &y);
#else
_cx_raw rx = i_valto(x), ry = i_valto(y);
- return i_cmp(&rx, &ry);
+ return i_cmp((&rx), (&ry));
#endif
}
@@ -169,7 +169,7 @@ _cx_memb(_value_eq)(const _cx_value* x, const _cx_value* y) {
return x == y;
#else
_cx_raw rx = i_valto(x), ry = i_valto(y);
- return i_eq(&rx, &ry);
+ return i_eq((&rx), (&ry));
#endif
}
#include "template.h"
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index 351e2244..ddf6eb01 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -405,7 +405,7 @@ STC_DEF _cx_iter
_cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, i_valraw raw) {
for (; i1.ref != i2.ref; ++i1.ref) {
i_valraw r = i_valto(i1.ref);
- if (i_eq(&raw, &r)) return i1;
+ if (i_eq((&raw), (&r))) return i1;
}
return i2;
}
@@ -414,7 +414,7 @@ STC_DEF int
_cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) {
i_valraw rx = i_valto(x);
i_valraw ry = i_valto(y);
- return i_cmp(&rx, &ry);
+ return i_cmp((&rx), (&ry));
}
#endif // !c_no_cmp
#endif // !_i_queue
diff --git a/include/stc/clist.h b/include/stc/clist.h
index 1b911d63..bf5201e7 100644
--- a/include/stc/clist.h
+++ b/include/stc/clist.h
@@ -287,7 +287,7 @@ STC_DEF _cx_iter
_cx_memb(_find_in)(_cx_iter it1, _cx_iter it2, i_valraw val) {
c_foreach (it, _cx_self, it1, it2) {
i_valraw r = i_valto(it.ref);
- if (i_cmp(&r, &val) == 0) return it;
+ if (i_cmp((&r), (&val)) == 0) return it;
}
it2.ref = NULL; return it2;
}
@@ -299,7 +299,7 @@ _cx_memb(_remove)(_cx_self* self, i_valraw val) {
while (prev) {
node = prev->next;
i_valraw r = i_valto(&node->value);
- if (i_cmp(&r, &val) == 0)
+ if (i_cmp((&r), (&val)) == 0)
prev = _cx_memb(_erase_after_)(self, prev), ++n;
else
prev = (node == self->last ? NULL : node);
@@ -311,7 +311,7 @@ static int
_cx_memb(_sort_cmp_)(const clist_VOID_node* x, const clist_VOID_node* y) {
i_valraw a = i_valto(&((const _cx_node *) x)->value);
i_valraw b = i_valto(&((const _cx_node *) y)->value);
- return i_cmp(&a, &b);
+ return i_cmp((&a), (&b));
}
static clist_VOID_node*
@@ -327,7 +327,7 @@ STC_DEF int
_cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) {
i_valraw rx = i_valto(x);
i_valraw ry = i_valto(y);
- return i_cmp(&rx, &ry);
+ return i_cmp((&rx), (&ry));
}
#endif // !c_no_cmp
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index d7f5d547..0873b155 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -291,14 +291,14 @@ STC_DEF void _cx_memb(_clear)(_cx_self* self) {
STC_DEF chash_bucket_t
_cx_memb(_bucket_)(const _cx_self* self, const _cx_rawkey* rkeyptr) {
- const uint64_t _hash = i_hash(rkeyptr, sizeof *rkeyptr);
+ const uint64_t _hash = i_hash(rkeyptr, (sizeof *rkeyptr));
uint8_t _hx; _cx_size _cap = self->bucket_count;
chash_bucket_t b = {c_paste(fastrange_,i_size)(_hash, _cap), (uint8_t)(_hash | 0x80)};
const uint8_t* _hashx = self->_hashx;
while ((_hx = _hashx[b.idx])) {
if (_hx == b.hx) {
_cx_rawkey _raw = i_keyto(_i_keyref(self->table + b.idx));
- if (i_eq(&_raw, rkeyptr)) break;
+ if (i_eq((&_raw), rkeyptr)) break;
}
if (++b.idx == _cap)
b.idx = 0;
@@ -377,7 +377,7 @@ _cx_memb(_erase_entry)(_cx_self* self, _cx_value* _val) {
if (! _hashx[j])
break;
_cx_rawkey _raw = i_keyto(_i_keyref(_slot + j));
- k = c_paste(fastrange_,i_size)(i_hash(&_raw, sizeof _raw), _cap);
+ k = c_paste(fastrange_,i_size)(i_hash((&_raw), (sizeof _raw)), _cap);
if ((j < i) ^ (k <= i) ^ (k > j)) /* is k outside (i, j]? */
_slot[i] = _slot[j], _hashx[i] = _hashx[j], i = j;
}
diff --git a/include/stc/cpque.h b/include/stc/cpque.h
index f862b7e4..23c81ab8 100644
--- a/include/stc/cpque.h
+++ b/include/stc/cpque.h
@@ -110,8 +110,8 @@ STC_INLINE void _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
STC_DEF void
_cx_memb(_sift_down_)(_cx_value* arr, const size_t idx, const size_t n) {
for (size_t r = idx, c = idx << 1; c <= n; c <<= 1) {
- c += (c < n && i_cmp(&arr[c], &arr[c + 1]) < 0);
- if (i_cmp(&arr[r], &arr[c]) >= 0) return;
+ c += (c < n && i_cmp((&arr[c]), (&arr[c + 1])) < 0);
+ if (i_cmp((&arr[r]), (&arr[c])) >= 0) return;
_cx_value t = arr[r]; arr[r] = arr[c]; arr[r = c] = t;
}
}
@@ -147,7 +147,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value value) {
_cx_memb(_reserve)(self, self->size*3/2 + 4);
_cx_value *arr = self->data - 1; /* base 1 */
size_t c = ++self->size;
- for (; c > 1 && i_cmp(&arr[c >> 1], &value) < 0; c >>= 1)
+ for (; c > 1 && i_cmp((&arr[c >> 1]), (&value)) < 0; c >>= 1)
arr[c] = arr[c >> 1];
arr[c] = value;
}
diff --git a/include/stc/csmap.h b/include/stc/csmap.h
index d3a7ec50..be1c2ff7 100644
--- a/include/stc/csmap.h
+++ b/include/stc/csmap.h
@@ -146,7 +146,7 @@ _cx_memb(_value_toraw)(_cx_value* val) {
STC_INLINE int
_cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) {
_cx_rawkey rx = i_keyto(_i_keyref(x)), ry = i_keyto(_i_keyref(y));
- return i_cmp(&rx, &ry);
+ return i_cmp((&rx), (&ry));
}
STC_INLINE void
@@ -301,7 +301,7 @@ _cx_memb(_find_it)(const _cx_self* self, i_keyraw rkey, _cx_iter* out) {
out->_top = 0;
while (tn) {
int c; _cx_rawkey raw = i_keyto(_i_keyref(&d[tn].value));
- if ((c = i_cmp(&raw, &rkey)) < 0)
+ if ((c = i_cmp((&raw), (&rkey))) < 0)
tn = d[tn].link[1];
else if (c > 0)
{ out->_st[out->_top++] = tn; tn = d[tn].link[0]; }
@@ -369,7 +369,7 @@ _cx_memb(_insert_entry_i_)(_cx_self* self, _cx_size tn, const _cx_rawkey* rkey,
while (tx) {
up[top++] = tx;
i_keyraw raw = i_keyto(_i_keyref(&d[tx].value));
- if ((c = i_cmp(&raw, rkey)) == 0) {res->ref = &d[tx].value; return tn; }
+ if ((c = i_cmp((&raw), rkey)) == 0) {res->ref = &d[tx].value; return tn; }
dir = (c < 0);
tx = d[tx].link[dir];
}
@@ -400,7 +400,7 @@ _cx_memb(_erase_r_)(_cx_node *d, _cx_size tn, const _cx_rawkey* rkey, int *erase
if (tn == 0)
return 0;
i_keyraw raw = i_keyto(_i_keyref(&d[tn].value));
- _cx_size tx; int c = i_cmp(&raw, rkey);
+ _cx_size tx; int c = i_cmp((&raw), rkey);
if (c != 0)
d[tn].link[c < 0] = _cx_memb(_erase_r_)(d, d[tn].link[c < 0], rkey, erased);
else {
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 3b3e1dde..c523ea45 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -384,7 +384,7 @@ STC_DEF _cx_iter
_cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, i_valraw raw) {
for (; i1.ref != i2.ref; ++i1.ref) {
i_valraw r = i_valto(i1.ref);
- if (i_eq(&raw, &r)) return i1;
+ if (i_eq((&raw), (&r))) return i1;
}
return i2;
}
@@ -395,7 +395,7 @@ _cx_memb(_bsearch_in)(_cx_iter i1, _cx_iter i2, i_valraw raw, _cx_iter* lower_bo
while (i1.ref != i2.ref) {
mid.ref = i1.ref + ((i2.ref - i1.ref) >> 1);
int c; i_valraw m = i_valto(mid.ref);
- if ((c = i_cmp(&raw, &m)) == 0) return *lower_bound = mid;
+ if ((c = i_cmp((&raw), (&m))) == 0) return *lower_bound = mid;
else if (c < 0) i2.ref = mid.ref;
else i1.ref = mid.ref + 1;
}
@@ -407,7 +407,7 @@ STC_DEF int
_cx_memb(_value_cmp)(const _cx_value* x, const _cx_value* y) {
i_valraw rx = i_valto(x);
i_valraw ry = i_valto(y);
- return i_cmp(&rx, &ry);
+ return i_cmp((&rx), (&ry));
}
#endif // !c_no_cmp
#endif // _i_implement