diff options
| author | Tyge Løvset <[email protected]> | 2021-03-11 11:29:57 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-03-11 11:29:57 +0100 |
| commit | c077e4b93a8d20c20b2626e2616d116be64247da (patch) | |
| tree | ad64f2bf54877fe2d47c54f0dbb7212277c87a28 /docs | |
| parent | 87ae20d6192380d2da50d439b88f89b6ff64a433 (diff) | |
| download | STC-modified-c077e4b93a8d20c20b2626e2616d116be64247da.tar.gz STC-modified-c077e4b93a8d20c20b2626e2616d116be64247da.zip | |
Renamed public *_result_t struct member names in maps/sets for consistency with iterators.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cmap_api.md | 5 | ||||
| -rw-r--r-- | docs/crandom_api.md | 9 | ||||
| -rw-r--r-- | docs/csmap_api.md | 22 |
3 files changed, 19 insertions, 17 deletions
diff --git a/docs/cmap_api.md b/docs/cmap_api.md index ce5b310d..e4aa886f 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -73,6 +73,7 @@ cmap_X_mapped_t* cmap_X_at(const cmap_X* self, RawKey rkey); size_t cmap_X_erase(cmap_X* self, RawKey rkey); cmap_X_iter_t cmap_X_erase_at(cmap_X* self, cmap_X_iter_t pos); +void cmap_X_erase_entry(cmap_X* self, cmap_X_value_t* entry); cmap_X_iter_t cmap_X_begin(const cmap_X* self); cmap_X_iter_t cmap_X_end(const cmap_X* self); @@ -104,7 +105,7 @@ void c_trivial_del(Type* val); // doe | `cmap_X_mapped_t` | `Mapped` | The mapped type | | `cmap_X_value_t` | `struct { Key first; Mapped second; }` | The value type | | `cmap_X_rawvalue_t` | `struct { RawKey first; RawMapped second; }` | RawKey + RawMapped type | -| `cmap_X_result_t` | `struct { cmap_X_value_t *first; bool second; }`| Result of insert/put/emplace | +| `cmap_X_result_t` | `struct { cmap_X_value_t *ref; bool inserted; }`| Result of insert/put/emplace | | `cmap_X_iter_t` | `struct { cmap_X_value_t *ref; ... }` | Iterator type | ## Constants and macros @@ -313,7 +314,7 @@ int main() cmap_vk_value_t *e = cmap_vk_find(&vikings, lookup).ref; e->second += 3; // add 3 hp points to Einar - cmap_vk_emplace(&vikings, lookup, 0).first->second += 5; // add 5 more to Einar + cmap_vk_emplace(&vikings, lookup, 0).ref->second += 5; // add 5 more to Einar c_foreach (k, cmap_vk, vikings) { printf("%s of %s has %d hp\n", k.ref->first.name.str, k.ref->first.country.str, k.ref->second); diff --git a/docs/crandom_api.md b/docs/crandom_api.md index d67a1fb3..36d66c3c 100644 --- a/docs/crandom_api.md +++ b/docs/crandom_api.md @@ -10,10 +10,11 @@ See [random](https://en.cppreference.com/w/cpp/header/random) for similar c++ fu **stc64** is a novel, extremely fast PRNG by Tyge Løvset, suited for parallel usage. It features a Weyl-sequence as part of the state. In general testing, **stc64** is the fastest among *pcg64*, -*xoshiro256`**`*, *sfc64*, and *lehmer64*. On some platforms, *wyrand64* is faster, but it has only -128-bit state with no minimum period length guarantee. +*xoshiro256`**`*, *sfc64*, and *lehmer64*. *wyrand* is faster on platforms with fast 128-bit +multiplication, and has 2^64 period length (https://github.com/lemire/SwiftWyhash/issues/10). +However, it is not suited for massive parallel usage due to its limited total minimal period length. -**stc64** does not require fast multiplication or 128-bit integer operations. It has 256 bit state, +**stc64** does not require multiplication or 128-bit integer operations. It has 256 bit state, but updates only 192 bit per generated number. There is no *jump function*, but each odd number Weyl-increment (state[3]) starts a new @@ -90,7 +91,7 @@ int main() csmap_i mhist = csmap_i_init(); c_forrange (N) { int index = (int) round( stc64_normalf(&rng, &dist) ); - ++ csmap_i_emplace(&mhist, index, 0).first->second; + ++ csmap_i_emplace(&mhist, index, 0).ref->second; } // Print the gaussian bar chart diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 8c3a31b5..7f7c5e96 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -79,17 +79,17 @@ csmap_X_value_t csmap_X_value_clone(csmap_X_value_t val); ``` ## Types -| Type name | Type definition | Used to represent... | -|:----------------------|:------------------------------------------------ |:-----------------------------| -| `csmap_X` | `struct { ... }` | The csmap type | -| `csmap_X_rawkey_t` | `RawKey` | The raw key type | -| `csmap_X_rawmapped_t` | `RawMapped` | The raw mapped type | -| `csmap_X_key_t` | `Key` | The key type | -| `csmap_X_mapped_t` | `Mapped` | The mapped type | -| `csmap_X_value_t` | `struct { Key first; Mapped second; }` | The value type | -| `csmap_X_rawvalue_t` | `struct { RawKey first; RawMapped second; }` | RawKey + RawVal type | -| `csmap_X_result_t` | `struct { csmap_X_value_t first; bool second; }` | Result of insert/put/emplace | -| `csmap_X_iter_t` | `struct { csmap_X_value_t *ref; ... }` | Iterator type | +| Type name | Type definition | Used to represent... | +|:----------------------|:--------------------------------------------------|:-----------------------------| +| `csmap_X` | `struct { ... }` | The csmap type | +| `csmap_X_rawkey_t` | `RawKey` | The raw key type | +| `csmap_X_rawmapped_t` | `RawMapped` | The raw mapped type | +| `csmap_X_key_t` | `Key` | The key type | +| `csmap_X_mapped_t` | `Mapped` | The mapped type | +| `csmap_X_value_t` | `struct { Key first; Mapped second; }` | The value type | +| `csmap_X_rawvalue_t` | `struct { RawKey first; RawMapped second; }` | RawKey + RawVal type | +| `csmap_X_result_t` | `struct { csmap_X_value_t *ref; bool inserted; }` | Result of insert/put/emplace | +| `csmap_X_iter_t` | `struct { csmap_X_value_t *ref; ... }` | Iterator type | ## Examples ```c |
