aboutsummaryrefslogtreecommitdiff
path: root/lib/std/hash
AgeCommit message (Collapse)Author
2025-09-18Remove usages of deprecatedWriterandrewkraevskii
2025-09-17use block break instead of returnmarko
2025-08-30std.hash.xxhash: disable xxhash3 test on all mips64 targetsAlex Rønne Petersen
See also dd1de18f9629904b5d97d5791a47244ac63385da. https://github.com/ziglang/zig/issues/23807
2025-07-31simplify std.hash.Adler32Andrew Kelley
2025-07-19std.hash.RapidHash: removeAndrew Kelley
Its design keeps evolving. See https://github.com/Nicoshev/rapidhash/releases It's great to see the design improving, but over time, this will lead to code rot; versions that aren't widely used but would still have to live in the standard library forever and be maintained. Better to be maintained as an external dependency that applications can opt into. Then, in a few years, if a version proves to be stable and widely adopted, it could be considered for inclusion in the standard library.
2025-07-19Changed u64 to usize to fix #24208Alexandre
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
Basically everything that has a direct replacement or no uses left. Notable omissions: - std.ArrayHashMap: Too much fallout, needs a separate cleanup. - std.debug.runtime_safety: Too much fallout. - std.heap.GeneralPurposeAllocator: Lots of references to it remain, not a simple find and replace as "debug allocator" is not equivalent to "general purpose allocator". - std.io.Reader: Is being reworked at the moment. - std.unicode.utf8Decode(): No replacement, needs a new API first. - Manifest backwards compat options: Removal would break test data used by TestFetchBuilder. - panic handler needs to be a namespace: Many tests still rely on it being a function, needs a separate cleanup.
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-07-07std.io: move getStdIn, getStdOut, getStdErr functions to fs.FileAndrew Kelley
preparing to rearrange std.io namespace into an interface how to upgrade: std.io.getStdIn() -> std.fs.File.stdin() std.io.getStdOut() -> std.fs.File.stdout() std.io.getStdErr() -> std.fs.File.stderr()
2025-06-01Legalize: implement scalarization of `@shuffle`Jacob Young
2025-05-16std.hash.Wyhash: fix dangling stack pointerMarc Tiehuis
Closes #23895.
2025-05-08std: Disable `hash.xxhash.test.xxhash3` on MIPS N32.Alex Rønne Petersen
https://github.com/ziglang/zig/issues/23807
2025-02-22Add rapidhash (#22085)Chris Covington
2025-01-16all: update to `std.builtin.Type.Pointer.Size` field renamesmlugg
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
2024-12-15correct the hint in `XxHash3`David Rubin
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-08-27compiler,lib,test,langref: migrate `@setCold` to `@branchHint`mlugg
2024-08-21std: update eval branch quotas after bdbc485mlugg
Also, update `std.math.Log2Int[Ceil]` to more efficient implementations that don't use up so much damn quota!
2024-07-09std: fix typos (#20560)Jora Troosh
2024-04-28std.hash.crc: update legacy crc usage in stdMarc Tiehuis
2024-04-28std.hash.crc: simplify apiMarc Tiehuis
This removes the two original implementations in favour of the single generic one based on the Algorithm type. Previously we had three, very similar implementations which was somewhat confusing when knowing what one should actually be used. The previous polynomials all have equivalent variants available when using the Algorithm type.
2024-04-11std.hash.crc: get rid of usingnamespaceBrandon Black
This flips things around such that std/hash/crc.zig is generated by the catalog-based generation tool, and the real code that used to be in that file is moved out to std/hash/crc/impl.zig. The generated tests are moved to std/hash/crc/test.zig. By going this route, we eliminate the need for usingnamespace without changing anything for callers of these interfaces. The Crc32 tests are simply added to the fixed part of the generated output and compactified a bit. This was the second-to-last usage of usingnamespace left in std.
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-02-08Replace std.rand references with std.Randome4m2
2023-12-08AstGen: add error for using inline loops in comptime only scopesVeikka Tuominen
2023-11-22std: remove meta.traitAndrew Kelley
In general, I don't like the idea of std.meta.trait, and so I am providing some guidance by deleting the entire namespace from the standard library and compiler codebase. My main criticism is that it's overcomplicated machinery that bloats compile times and is ultimately unnecessary given the existence of Zig's strong type system and reference traces. Users who want this can create a third party package that provides this functionality. closes #18051
2023-11-19lib: correct unnecessary uses of 'var'mlugg
2023-11-03x86_64: fix std test failuresJacob Young
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-10-31mem: fix ub in writeIntJacob Young
Use inline to vastly simplify the exposed API. This allows a comptime-known endian parameter to be propogated, making extra functions for a specific endianness completely unnecessary.
2023-10-29x86_64: fix compiler rt test failuresJacob Young
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-21x86_64: fix bugs and disable erroring testsJacob Young
2023-10-17XXH3 Implementation for Zig STD (#17530)David
XXH3 is the faster alternative to XXH64 which utilizes SIMD when hashing large chunks of memory and similar mixing to WyHash (64x64 -> 128 mul) for smaller inputs. Co-authored-by: Reixcon226 <87927264+Rexicon226@users.noreply.github.com> --------- Co-authored-by: kprotty <kbutcher6200@gmail.com>
2023-09-02std/hash: perform iterative + smhasher tests at comptimeMarc Tiehuis
Need to confirm how these fare on CI as per previous comments left which stated OOM (on stage-1).
2023-09-02std/hash: add generic tests for idempotency/iterative apiMarc Tiehuis
2023-09-02std/hash: add smhasher verification testsMarc Tiehuis
Not all hashes are added just yet as these need to be generated manually from reference implementations as they are not included by default in smhasher.
2023-08-05wyhash: keep tail bytes on iterative updatenone
Update calls with input longer then one block must ensure that last sixteen bytes are available when final is called. Fixes #16695
2023-07-24Xxhash perf (#15947)Dominic
Improvements for xxHash performance, both on small keys as well as large slices. * std.hash: make benchmarks consistent for xxhash There is some odd behaviour in the timings for the XXHash benchmarks introduced in 879f0b9, specifically the changes to the allocation in benchmarkHash. The problem is somewhere in the difference between 9628243 and 9362d61 (these are commit that were force-pushed over but can be found in PR #15917). * std.hash: correctly calculate throughput in benchmark * std.hash: add hashes per sec to small key output * std.hash: add exact and small xxhash routines * std.hash: add --small-only flag to benchmark * std.hash.xxhash: extract stateless Accumulator type * std.hash.xxhash: cleanup hash() and improve small key perf * std.hash.xxhash: port xxhash64 changes to xxhash32 * std.hash: change benchmark --small-only flag to --include-array
2023-07-24Use builtin inference over @as where possibleZachary Raineri
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-17wyhash: support comptime usageMarc Tiehuis
Closes #16070.
2023-06-16migration: std.math.{min, min3, max, max3} -> `@min` & `@max`r00ster91
2023-06-13std.meta: remove `Vector` (deprecated in 0.10)Eric Joldasov
Followup to d42d31f72f38165f70c2850e9cc63da44b3b470c. Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-10std.hash: improve small-key hashing in WyhashAndrew Kelley
Instead of carrying an optimized version of wyhash in the compiler for small keys, put it into the std lib where it belongs. ...except it does not match the official test cases. This will need to be fixed before merging into master. This is an extremely contributor-friendly task. Related issue: #15916