setKey used to just call rebuildIndex which allocates a new index and
inserts into it all entries. This is the only allocation that setKey
needed to do.
Instead I propose that setKey sets the key in the entries and then does
a remove of the old key from the index and insert of the new key into
the index. This eliminates the need for setKey to allocate and makes
it infallible
To achieve this I extracted a helper function for inserting a single
entry into the index. Function for removing one entry from the index
already exists. setKey now just calls these two functions.
Since `packed` containers are now internally represented by a `bitpack`,
they need special handling on initialization: they need to be either
bitpacked or bitcasted to their backing integer. `Sema` already did this,
but `LowerZon` didn't yet.
`HINSTANCE` is `*opaque {}` so using a type that should be compatible from alternate bindings (zigwin32, for example) would be a (false positive) compile error without this ptrCast.
Largely mirrors Haiku, Serenity provides crt0 and GCC the rest (though
only crtbegin/crtend are used as per serenity's toolchain patches[1]):
```
$ find Build/aarch64/Root -iname 'crt*.o'
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtbeginS.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtend.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtbegin.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtfastmath.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crti.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtn.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtendS.o
Build/aarch64/Root/usr/lib/crt0.o
```
Serenity has a GCC and LLVM toolchain that work equally well, support
for the latter may be added in the future.
[1]: https://github.com/SerenityOS/serenity/blob/727c4a3d1a6748221b383207dac354e564b6150d/Toolchain/Patches/gcc/0001-Add-a-gcc-driver-for-SerenityOS.patch#L120-L127
This PR merges the functionality of the `getLastOrNull` method into `getLast`, which improves consistency as its
based on methods like `front`, `back`, and `peek` in the `Deque` and `PriorityQueue` containers.
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32008
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Because this syntax is not heavily used, and the migration can be done
with a simple text substitution, I do not believe a `zig fmt` fixup is
necessary for this change.
Resolves: https://github.com/ziglang/zig/issues/15213
Executables are always ET_DYN on Haiku, so like shared libraries, they should
not have an image base set. Elf2 already got this right, but Elf and Lld didn't.
closes https://codeberg.org/ziglang/zig/issues/32100
It's a fairly straightforward port of `musl`'s `rintl`, like `rint` and `rintf` were. `libc-test` tests for `rintl` are uncommented since they're now passing.
I've also covered special cases for `rint` with tests, and broke down the current `rint` and `modf` test declarations into multiple -- so each libc function get its own test declaration at the very least.
Contributes to #30978
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31791
Reviewed-by: Andrew Kelley <andrew@ziglang.org>