Commit Graph

7 Commits

Author SHA1 Message Date
gingerBill
4aca9372a6 Improve resize call 2022-08-08 12:11:30 +01:00
gingerBill
c53426fcb4 Merge pull request #1818 from IanLilleyT/reserve_exceed
Dynamic array append reserves more space when it exceeds capacity
2022-06-12 17:19:08 +01:00
Tetralux
fa2296a124 [runtime] Add builtin shrink for dynamic arrays and maps
Asks the allocator to shrink the backing allocation to the current __length__, or a capacity
of the user's choosing.

Returns `(did_shrink: bool, err: mem.Allocator_Error)`.

```
shrink(&array) // shrinks to len(array)
shrink(&array, N) // shrink to N capacity

shrink(&map) // shrinks down to len(map)
shrink(&map, N) // shrink to N capacity
```
2022-06-04 23:29:47 +00:00
Ian Lilley
ee9908b09e Reserve more space when exceeding, not meeting, capacity 2022-06-01 22:01:00 -04:00
gingerBill
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
gingerBill
f98c4d6837 Improve the Allocator interface to support returning Allocator_Error to allow for safer calls
Virtually all code (except for user-written custom allocators) should work as normal. Extra features will need to be added to make the current procedures support the `Allocator_Error` return value (akin to #optional_ok)
2021-04-19 12:31:31 +01:00
gingerBill
913eac13b1 Reorganize runtime code into separate files 2020-11-19 00:08:23 +00:00