summaryrefslogtreecommitdiffhomepage
path: root/stc
diff options
context:
space:
mode:
authortylo <[email protected]>2020-09-07 10:15:41 +0200
committertylo <[email protected]>2020-09-07 10:17:15 +0200
commit2dbbf289ae169bbe633632fa119557fab36fdbb4 (patch)
tree90c0cbe1f989290f26f5671e34cb56ec6b93c951 /stc
parent5b78847871217562dcddbb0bd34076a892eb49e1 (diff)
downloadSTC-modified-2dbbf289ae169bbe633632fa119557fab36fdbb4.tar.gz
STC-modified-2dbbf289ae169bbe633632fa119557fab36fdbb4.zip
Added back cmap insert()
Diffstat (limited to 'stc')
-rw-r--r--stc/cmap.h9
-rw-r--r--stc/crandom.h4
2 files changed, 6 insertions, 7 deletions
diff --git a/stc/cmap.h b/stc/cmap.h
index 8ee50ec3..1ba079c2 100644
--- a/stc/cmap.h
+++ b/stc/cmap.h
@@ -218,17 +218,16 @@ ctype##_##X##_contains(const ctype##_##X* self, ctype##_##X##_rawkey_t rawKey);
STC_API ctype##_##X##_result_t \
ctype##_##X##_insert_key_(ctype##_##X* self, ctype##_##X##_rawkey_t rawKey); \
\
-CSET_ONLY_##ctype( STC_INLINE ctype##_##X##_result_t \
-ctype##_##X##_insert(ctype##_##X* self, ctype##_##X##_rawkey_t rawKey) { \
- return ctype##_##X##_insert_key_(self, rawKey); \
-}) \
STC_INLINE ctype##_##X##_result_t \
ctype##_##X##_emplace(ctype##_##X* self, CMAP_ARGS_##ctype(ctype##_##X##_rawkey_t rawKey, RawValue rawValue)) { \
ctype##_##X##_result_t res = ctype##_##X##_insert_key_(self, rawKey); \
CMAP_ONLY_##ctype( if (res.inserted) res.item->value = valueFromRaw(rawValue); ) \
return res; \
} \
- \
+STC_INLINE ctype##_##X##_result_t \
+ctype##_##X##_insert(ctype##_##X* self, CMAP_ARGS_##ctype(ctype##_##X##_rawkey_t rawKey, RawValue rawValue)) { \
+ return ctype##_##X##_emplace(self, CMAP_ARGS_##ctype(rawKey, rawValue)); \
+} \
CMAP_ONLY_##ctype( \
STC_INLINE ctype##_##X##_result_t \
ctype##_##X##_insert_or_assign(ctype##_##X* self, ctype##_##X##_rawkey_t rawKey, RawValue rawValue) { \
diff --git a/stc/crandom.h b/stc/crandom.h
index d1a85395..07457332 100644
--- a/stc/crandom.h
+++ b/stc/crandom.h
@@ -133,7 +133,7 @@ STC_API double crand_normal_f64(crand_normal_f64_t* dist);
#if !defined(STC_HEADER) || defined(STC_IMPLEMENTATION)
STC_API crand_rng32_t crand_rng32_with_seq(uint64_t seed, uint64_t seq) {
- crand_rng32_t rng = {0u, (seq << 1u) | 1u}; /* inc must be odd */
+ crand_rng32_t rng = {{0u, (seq << 1u) | 1u}}; /* inc must be odd */
crand_i32(&rng);
rng.state[0] += seed;
crand_i32(&rng);
@@ -155,7 +155,7 @@ STC_API uint32_t crand_i32(crand_rng32_t* rng) {
/* Guarantees 2^63 unique threads with minimum 2^64 period length ~ 2^160 average period. */
/* Tested with PractRand to 8 TB output: no issues */
STC_API crand_rng64_t crand_rng64_with_seq(uint64_t seed, uint64_t seq) {
- crand_rng64_t rng = {seed, seed, seed, (seq << 1u) | 1u}; /* increment must be odd */
+ crand_rng64_t rng = {{seed, seed, seed, (seq << 1u) | 1u}}; /* increment must be odd */
for (int i = 0; i < 12; ++i) crand_i64(&rng);
return rng;
}