aboutsummaryrefslogtreecommitdiff
path: root/lib/std/priority_dequeue.zig
AgeCommit message (Collapse)Author
2024-07-23add std.testing.random_seedAndrew Kelley
closes #17609
2024-02-26Remove redundant test name prefixes now that test names are fully qualifiedRyan Liptak
Follow up to #19079, which made test names fully qualified. This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit: "priority_queue.test.std.PriorityQueue: shrinkAndFree" and the same test's name after the changes in this commit: "priority_queue.test.shrinkAndFree"
2024-02-08Replace std.rand references with std.Randome4m2
2023-11-19lib: correct unnecessary uses of 'var'mlugg
2023-10-23x86_64: implement 128-bit builtinsJacob Young
* `@clz` * `@ctz` * `@popCount` * `@byteSwap` * `@bitReverse` * various encodings used by std
2023-10-22Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""Jacob Young
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"Andrew Kelley
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
2023-10-21x86_64: disable failing tests, enable test-std testingJacob Young
2023-10-12Update docs of PriorityQueue.iterator() and PriorityDeque.iterator()Alexander Heinrich
2023-06-22[priority_dequeue] Fix out-of-bounds accessNiles Salter
This makes it so `first_child_index` will not be accessed when it is equal to `self.len`. (i.e. `self.items[self.len]` will not happen) The access itself was "safe" (as in, `self.len < self.items.len`) because we were only calling `doSiftDown` in the case where there was a stale value at `self.items[self.len]`. However, it is still technically a bug, and can manifest by an unnecessary comparison of a value to a copy of itself.
2023-06-22[priority_deque] simplify & optimize isMinLayerNiles Salter
LLVM has trouble compiling the old implementation, (presumably) because `leading_zeros` is thought to be a `u7` rather than a `u6`, which means `63 - clz` is not equivalent to `63 ^ clz`, which means it can't deduce that the final condition can simply be flipped. (I am assuming `usize` is a `u64` here for ease of understanding, but it's the same for any power of 2) https://zig.godbolt.org/z/Pbj4P7ob3 The new version is slightly better too because `isMinLayer(maxInt(usize))` is now well-defined behavior.
2023-05-08Disallow named test decls with duplicate namesDominic
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2022-12-13std: Fix update() method in PriorityQueue and PriorityDequeue (#13908)Frechdachs
Previously the update() method would iterate over its capacity, which may contain uninitialized memory or already removed elements.
2022-09-16std: remove deprecated API for the upcoming releaseAndrew Kelley
See #3811
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-07-25PriorityDequeue: use compareFn in update() methodVÖRÖSKŐI András
2021-12-15std.priority_dequeue: allow comparator to take a context parameterArnavion
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-10-27std.rand: Refactor `Random` interfaceOminitay
These changes have been made to resolve issue #10037. The `Random` interface was implemented in such a way that causes significant slowdown when calling the `fill` function of the rng used. The `Random` interface is no longer stored in a field of the rng, and is instead returned by the child function `random()` of the rng. This avoids the performance issues caused by the interface.
2021-10-17Move `compareFn` from init to type constructor in `PriorityQueue` and ↵Max Hollmann
`PriorityDequeue`. This change significantly improves performance for simple compare functions and modifies the API to be more consistent with e.g. `HashMap`.
2021-09-19std.PriorityDequeue: ensureUnusedCapacity and ensureTotalCapacityRyan Liptak
Same as c8ae581fef6506a8234cdba1355ba7f0f449031a, but for PriorityDequeue.
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-06-21fix code broken from previous commitJacob G-W
2021-05-12fix shrinkAndFree and remove shrinkRetainingCapacity in PriorityQueue and ↵Matthew Borkowski
PriorityDequeue
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-01-18Change `compareFn` to `fn (a: T, b: T) std.math.Order`Zander Khan
2021-01-17Remove `resize`. Adding uninitialized memory at the end of the `items` would ↵Zander Khan
break the heap property.
2021-01-17Replace `shrink` with `shrinkAndFree` and `shrinkRetainingCapacity`Zander Khan
2021-01-16Fix slice length when updatingZander Khan
2021-01-16Fix update might change an element no longer in the queueZander Khan
2021-01-16Rename heap to queue in tests for consistencyZander Khan
2021-01-16Fix edge cases in fromOwnedSliceZander Khan
2021-01-16Ensure we cannot remove an item outside the current length of the queueZander Khan
2021-01-16Remove magic numberZander Khan
2021-01-16Add license to top of fileZander Khan
2021-01-16std: Add Priority DequeueZander Khan