Jacob Young
32e85d44eb
x86_64: disable failing tests, enable test-std testing
2023-10-21 10:55:41 -04:00
Alexander Heinrich
4e188dd66c
Update docs of PriorityQueue.iterator() and PriorityDeque.iterator()
2023-10-12 04:48:22 +03:00
Validark
8b1976cab5
[priority_queue] Simplify sifting & fix edge case
2023-07-24 12:58:19 -07:00
Andrew Kelley
aeaef8c0ff
update std lib and compiler sources to new for loop syntax
2023-02-18 19:17:21 -07:00
Frechdachs
478544239e
std: Fix update() method in PriorityQueue and PriorityDequeue ( #13908 )
...
Previously the update() method would iterate over its capacity, which may contain uninitialized memory or already removed elements.
2022-12-13 14:55:41 -05:00
Andrew Kelley
d3d24874c9
std: remove deprecated API for the upcoming release
...
See #3811
2022-09-16 14:46:53 -04:00
VÖRÖSKŐI András
d925d19cfc
PriorityQueue: use compareFn in update()
...
update() calls mem.indexOfScalar() which uses `==` for comparing items,
which fails when the operator is not supported.
As PirorityQueue needs a comparing function anyway we can use `.eq` results
to identify matching objects.
closes #9918
2022-07-22 19:25:38 +03:00
Andrew Kelley
c3ae909e93
Revert "AstGen: preserve inferred ptr result loc for breaks"
...
This reverts commit 8bf3e1f8d0 , which
introduced miscompilations for peer expressions any time they needed
coercions to runtime types.
I opened #11957 as a proposal to accomplish the goal of the reverted
commit.
Closes #11898
2022-06-28 18:38:25 -07:00
Veikka Tuominen
6b36774adc
std: disable failing tests, add zig2 build test-std to CI
2022-06-12 10:43:28 +03:00
Veikka Tuominen
413577c881
std: adjust for stage2 semantics
2022-06-07 21:27:07 +03:00
joachimschmidt557
7deae07101
std.PriorityQueue: fix missing siftUp in remove
...
When the replacement node is smaller than its parent, we need to sift
up instead of sifting down.
2022-05-26 14:50:24 -04:00
Eric Shrewsberry
497f8a6098
Fix bug in PriorityQueue::removeIndex()
...
Fix to call siftDown on the removed index instead of always on index 0.
Updated test to a test that fails before and passes now.
PriorityDequeue does not have this issue.
2022-04-14 02:54:41 -04:00
Arnavion
82e8930656
std.priority_queue: allow comparator to take a context parameter
2021-12-15 17:46:04 -08:00
Lee Cannon
85de022c56
allocgate: std Allocator interface refactor
2021-11-30 23:32:47 +00:00
Andrew Kelley
902df103c6
std lib API deprecations for the upcoming 0.9.0 release
...
See #3811
2021-11-30 00:13:07 -07:00
Max Hollmann
53b87fa78a
Move compareFn from init to type constructor in PriorityQueue and PriorityDequeue.
...
This change significantly improves performance for simple compare functions and modifies
the API to be more consistent with e.g. `HashMap`.
2021-10-17 17:47:43 -04:00
Ryan Liptak
2be3b1d2bf
std.PriorityQueue: ensureUnusedCapacity and ensureTotalCapacity
...
Same as c8ae581fef , but for PriorityQueue.
2021-09-19 13:52:56 +02:00
Andrew Kelley
d29871977f
remove redundant license headers from zig standard library
...
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-08-24 12:25:09 -07:00
Jacob G-W
9fffffb07b
fix code broken from previous commit
2021-06-21 17:03:03 -07:00
Matthew Borkowski
40a47eae65
fix shrinkAndFree and remove shrinkRetainingCapacity in PriorityQueue and PriorityDequeue
2021-05-12 18:33:25 -04:00
Veikka Tuominen
fd77f2cfed
std: update usage of std.testing
2021-05-08 15:15:30 +03:00
Andrew Kelley
d780848ae4
Merge pull request #7792 from zanderxyz/zanderxyz/priority-dequeue
...
std: Add Priority Dequeue
2021-04-02 10:52:23 -07:00
daurnimator
d4af35b3fe
HashMap.put returns !void, not a !bool
2021-02-27 13:11:47 +02:00
Zander Khan
ce22c70586
Change compareFn to fn (a: T, b: T) std.math.Order
2021-01-18 19:02:11 +00:00
Zander Khan
5bfd9238de
Remove resize. Adding uninitialized memory at the end of the items would break the heap property.
2021-01-17 14:43:38 +00:00
Zander Khan
9a09ebb1b9
Replace shrink with shrinkAndFree and shrinkRetainingCapacity
2021-01-17 14:41:20 +00:00
Zander Khan
e1ab425bce
Fix slice length when updating
2021-01-16 18:43:13 +00:00
Zander Khan
c6986f29f9
Fix update might change an element no longer in the queue
2021-01-16 18:11:26 +00:00
Zander Khan
4d09803414
Fix edge cases in fromOwnedSlice
2021-01-16 18:06:44 +00:00
Zander Khan
94c47855ec
Add missing import
2021-01-16 17:48:29 +00:00
Frank Denis
6c2e0c2046
Year++
2020-12-31 15:45:24 -08:00
Vexu
7e30e83900
small fixes and zig fmt
2020-12-09 13:54:26 +02:00
Bhargav Srinivasan
84406d98e4
removing redundant assert
2020-09-22 05:12:21 -07:00
Bhargav Srinivasan
778bb4b324
return not found error correctly
2020-09-22 03:50:28 -07:00
Bhargav Srinivasan
983830a4ae
replace linearSearch with mem.indexOfScalar, return not found error, factor out siftUp from addUnchecked, use compareFn to decide siftUp/siftDown
2020-09-22 03:46:13 -07:00
Bhargav Srinivasan
a5140cc902
implemented efficient heapreplace
2020-09-22 02:12:35 -07:00
Bhargav Srinivasan
1345f87f4e
items are not sorted, using linear search
2020-09-22 01:50:22 -07:00
Bhargav Srinivasan
69f0fc513a
sorry, local compiler using different version of zig
2020-09-22 01:36:41 -07:00
Bhargav Srinivasan
f083ea88d8
using binary search function from std.sort
2020-09-22 01:05:33 -07:00
Bhargav Srinivasan
26de64be13
adding a function to update the priority of an element
2020-09-21 23:09:22 -07:00
Literally Void
78baa16da0
Fix issue #6303 : iterating empty PriorityQueue crashes
2020-09-10 12:00:53 +03:00
Andrew Kelley
4a69b11e74
add license header to all std lib files
...
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
joachimschmidt557
0ae1157e45
std.mem.dupe is deprecated, move all references in std
...
Replaced all occurences of std.mem.dupe in stdlib with
Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-07-04 21:40:06 +03:00
Vexu
76681e6b96
Make PriorityQueue.Iterator public
...
The `iterator` function was already public but these seem to have been forgotten.
2020-05-13 18:38:03 +03:00
Benjamin Feng
b077f3ab7d
Promoted "leak_count_allocator" to the main testing.allocator
2020-01-29 22:22:00 -06:00
Benjamin Feng
aa9caf5064
Create leak_count_allocator
2020-01-29 14:37:01 -06:00
Benjamin Feng
4d134a01f5
Move debug.global_allocator to testing.allocator
2020-01-29 12:21:29 -06:00
Nathan Michaels
38ce7f64e3
Add removeIndex function to PriorityQueue ( #4070 )
...
It's awkward to use, but lets me cancel events in an event queue.
Co-authored-by: Dmitry Atamanov <data-man@users.noreply.github.com>
2020-01-08 13:55:47 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args
2019-12-08 22:53:51 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
...
* Implements #3768 . This is a sweeping breaking change that requires
many (trivial) edits to Zig source code. Array values no longer
coerced to slices; however one may use `&` to obtain a reference to
an array value, which may then be coerced to a slice.
* Adds `IrInstruction::dump`, for debugging purposes. It's useful to
call to inspect the instruction when debugging Zig IR.
* Fixes bugs with result location semantics. See the new behavior test
cases, and compile error test cases.
* Fixes bugs with `@typeInfo` not properly resolving const values.
* Behavior tests are passing but std lib tests are not yet. There
is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00