diff options
| author | Tyge Løvset <[email protected]> | 2021-09-06 23:06:17 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-06 23:06:17 +0200 |
| commit | 007d8a204df58a2e051f9de3c417b3a0fbf3f515 (patch) | |
| tree | c721a244febf91a3374b40dbd50292b7956974ba /include | |
| parent | fe498c3f4518d4946ecb31aa3c56553d1901634a (diff) | |
| download | STC-modified-007d8a204df58a2e051f9de3c417b3a0fbf3f515.tar.gz STC-modified-007d8a204df58a2e051f9de3c417b3a0fbf3f515.zip | |
Removed some old memcpy not needed anymore.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cmap.h | 12 | ||||
| -rw-r--r-- | include/stc/csmap.h | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 71c9b718..d6f480d0 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -134,14 +134,14 @@ STC_INLINE bool cx_memb(_contains)(const Self* self, i_KEYRAW rkey) cx_MAP_ONLY(
STC_API cx_result_t cx_memb(_insert_or_assign)(Self* self, i_KEY _key, i_VAL _mapped);
STC_API cx_result_t cx_memb(_emplace_or_assign)(Self* self, i_KEYRAW rkey, i_VALRAW rmapped);
-
+
STC_INLINE cx_result_t /* short-form, like operator[]: */
- cx_memb(_put)(Self* self, i_KEY key, i_VAL mapped) {
+ cx_memb(_put)(Self* self, i_KEY key, i_VAL mapped) {
return cx_memb(_insert_or_assign)(self, key, mapped);
}
-
+
STC_INLINE cx_mapped_t*
- cx_memb(_at)(const Self* self, i_KEYRAW rkey) {
+ cx_memb(_at)(const Self* self, i_KEYRAW rkey) {
chash_bucket_t b = cx_memb(_bucket_)(self, &rkey);
return &self->table[b.idx].second;
}
@@ -346,7 +346,7 @@ cx_memb(_reserve)(Self* self, size_t _newcap) { if (_tmp._hashx[i]) {
cx_rawkey_t _raw = i_KEYTO(cx_keyref(e));
chash_bucket_t b = cx_memb(_bucket_)(self, &_raw);
- memcpy((void *) &_slot[b.idx], e, sizeof *e);
+ _slot[b.idx] = *e;
_hashx[b.idx] = (uint8_t) b.hx;
}
c_free(_tmp._hashx);
@@ -366,7 +366,7 @@ cx_memb(_erase_entry)(Self* self, cx_value_t* _val) { cx_rawkey_t _raw = i_KEYTO(cx_keyref(_slot+j));
k = c_PASTE(fastrange_,MAP_SIZE_T)(i_HASH(&_raw, sizeof _raw), _cap);
if ((j < i) ^ (k <= i) ^ (k > j)) /* is k outside (i, j]? */
- memcpy((void *) &_slot[i], &_slot[j], sizeof *_slot), _hashx[i] = _hashx[j], i = j;
+ _slot[i] = _slot[j], _hashx[i] = _hashx[j], i = j;
}
_hashx[i] = 0;
--self->size;
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index 38608991..2b0a9245 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -56,7 +56,7 @@ struct csmap_rep { size_t root, disp, head, size, cap; void* nodes[]; }; #define _csmap_rep(self) c_container_of((self)->nodes, struct csmap_rep, nodes)
#if !defined cx_forwarded
- _c_aatree_types(Self, C, i_KEY, i_VAL);
+ _c_aatree_types(Self, C, i_KEY, i_VAL);
#endif
\
@@ -380,7 +380,7 @@ static struct csmap_rep _csmap_sentinel = {0, 0, 0, 0, 0}; tx = d[tn].link[0]; \
while (d[tx].link[1]) \
tx = d[tx].link[1]; \
- memcpy((void *) &d[tn].value, &d[tx].value, sizeof d[0].value); /* move */ \
+ d[tn].value = d[tx].value; /* move */ \
raw = i_KEYTO(cx_keyref(&d[tn].value)); \
d[tn].link[0] = cx_memb(_erase_r_)(d, d[tn].link[0], &raw, erased); \
} else { /* unlink node */ \
|
