64 Commits

Author SHA1 Message Date
gingerBill 842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn a1be1b63d5 [core:hash] Add CCITT CRC-16 2025-10-21 16:33:07 +02:00
Jeroen van Rijn ece213afca Render examples. 2025-10-10 12:24:28 +02:00
Jeroen van Rijn 7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn 8a35acd506 More package lines. 2025-10-09 20:11:06 +02:00
Jeroen van Rijn 51cd08296f package lines for core:hash 2025-10-09 16:58:41 +02:00
Barinzaya 4ef7ed1cbd Skip bounds checking on the inner accumulate loop.
This helps performance with SSE (somewhat) and AVX-512 (quite a bit),
but not AVX2 for some reason.
2025-07-31 16:51:42 -04:00
Barinzaya f61dc7d071 Remove favor_size attributes inhibiting SIMD optimizations.
This makes a tremendous (2x with SSE2, 3x with AVX2) difference on big
datasets on my system, but this may be hardware-dependent (e.g.
instruction cache sizes).

Naturally, this also results in somewhat larger code for the large-data
case (~75% larger).
2025-07-31 13:05:10 -04:00
Barinzaya 2f8b390c19 Various minor changes in XXH3.
This includes various minor things that didn't seem right or could be
improved, including:
- XXH3_state is documented to have a strict alignment requirement of 64
  bytes, and thus came with a disclaimer not to use `new` because it
  wouldn't be aligned correctly. It now has an `#align(64)` so that it
  will.
- An _internal proc being marked #force_no_inline (every other one is
  #force_inline)
- Unnecessarily casting the product of two u32s through u128 (and
  ultimately truncating to u64 anyway)
2025-07-31 13:05:10 -04:00
Barinzaya 9d40f371be Add static SIMD support to XXH3 in core:hash/xxhash.
This uses compile-time features to decide how large of a SIMD vector to
use. It currently has checks for amd64/i386 to size its vectors for
SSE2/AVX2/AVX512 as necessary.

The generalized SIMD functions could also be useful for multiversioning
of the hash procs, to allow for run-time dispatch based on available CPU
features.
2025-07-31 13:05:08 -04:00
Jeroen van Rijn 3a7e4873cd Fix #5498
Also:
- Expands `tests/core/hash`
- Fixes bug found in `#hash(s, "murmur64")`
2025-07-25 12:00:24 +02:00
Jeroen van Rijn db5c45602d Remove outdated optimization attributes. 2025-05-27 17:57:06 +02:00
Laytan Laats 288312a812 core: improve package doc comments for the documentation generator 2024-09-03 19:59:04 +02:00
gingerBill eb799393d5 Fix -vet-tabs issues 2024-08-24 13:56:41 +01:00
Laytan Laats 2d8d0dd851 fix @(optimization_mode) usage in builtin collections 2024-07-08 21:07:53 +02:00
gingerBill 3f9a58808c More style improvements 2024-06-29 19:07:34 +01:00
gingerBill b378eb2df3 Fix free bug not using the correct allocator 2024-03-27 12:54:52 +00:00
gingerBill 6422c090f2 Make hash procedures contextless where possible 2024-03-27 12:54:37 +00:00
gingerBill 3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill a5a7226885 Remove auto_cast 2023-01-16 12:09:09 +00:00
gingerBill dcf2c43863 Add aliases for fnv* no_a forms 2022-11-29 11:55:01 +00:00
gingerBill e8bc576b23 Rename fnv32 and fnv64 to fnv32_no_a and fnv64_no_a 2022-11-03 11:44:19 +00:00
Jeroen van Rijn 3e6ec65dd9 Fix murmur64a's tail handling.
Also, split up the murmur64 proc into murmur64a and murmur64b as they're distinct hashes with their own output.
2022-07-15 13:02:07 +02:00
Jeroen van Rijn 5332705e31 [hash] Give crc-64 a 64-bit seed. 2022-07-14 11:07:52 +02:00
gingerBill 8c1499dbc2 Make raw_data return [^]T types 2022-05-23 11:48:05 +01:00
Jeroen van Rijn b99940f33a [xxhash] For the streaming tests, randomly select the size to use.
Randomize size used with `update`.

It'll print "Using user-selected seed {18109872483301276539,2000259725719371} for update size randomness."

If a streaming test then fails, you can repeat it using:
`odin run . -define:RAND_STATE=18109872483301276539 -define:RAND_INC=2000259725719371`
2022-05-02 19:20:25 +02:00
Jeroen van Rijn 6985181961 [xxhash] Add tests for large inputs
Test XXH32, XXH64, XXH3-64 and XXH3-128 for large inputs, with both all-at-once and streaming APIs.

XXH32_create_state and XXH64_create_state now implicitly call their "reset state" variants to simplify the streaming API to 3 steps:
- create state / defer destroy
- update
- digest (finalize)

These are tested with an array of 1, 2, 4, 8 and 16 megabytes worth of zeroes.
All return the same hashes as do both the one-shot version, as well as that of the official xxhsum tool.

3778/3778 tests successful.
2022-05-02 17:51:39 +02:00
Jeroen van Rijn 335b724209 [xxh3] Fix flaws in streaming implementation 2022-05-01 12:47:05 +02:00
gingerBill c6dc517004 Correct: murmur32 2022-03-11 08:52:16 +00:00
gingerBill f0529535e0 ODIN_ENDIAN changed to an enum constant; ODIN_ENUM_STRING is the new string version of the old constant 2022-01-15 17:53:18 +00:00
gingerBill c987b84292 Move bash.djbx33a to hash.odin 2021-12-29 12:24:47 +00:00
gingerBill a9b17b5a37 Add hash.djbx33a 2021-12-29 12:01:07 +00:00
gingerBill 12c1291805 Add optional seed parameters to all hashes 2021-11-18 16:14:33 +00:00
Jeroen van Rijn 6e22a6dfa5 hash: Smaller CRC-64 ISO 3306 table. 2021-09-21 16:28:35 +02:00
Jeroen van Rijn 181eabcffc hash: Add CRC-64 (ISO 3306) and inverse. 2021-09-21 16:17:01 +02:00
Jeroen van Rijn b600ffba3b Correct CRC-64 (ECMA 182) & add CRC-64 (XZ) and tests. 2021-09-21 15:17:23 +02:00
gingerBill b427bd8105 Correct XXH_DISABLE_PREFETCH usage 2021-09-18 12:59:54 +01:00
gingerBill 6855538729 Merge branch 'master' into llvm-12.0.1-windows 2021-09-18 12:55:13 +01:00
Jeroen van Rijn b6d0a8fe0c xxhash: Add tests for streaming input. 2021-09-15 23:32:48 +02:00
Jeroen van Rijn 662d27b796 Finish xxHash implementation. 2021-09-15 20:06:07 +02:00
Jeroen van Rijn a641ef95c0 Add XXH3-64 + tests. 2021-09-13 20:58:26 +02:00
Jeroen van Rijn 00c1d34108 xxhash: Extra (generated) tests. 2021-09-11 23:45:08 +02:00
gingerBill 7260d3cecb Add intrinsics.prefetch_* procedures 2021-09-11 17:30:44 +01:00
Jeroen van Rijn 5f920414d7 xxhash: Disable prefetch on Linux. 2021-09-11 15:45:17 +02:00
Jeroen van Rijn 72782d9035 xxhash: Fix test on Linux. 2021-09-11 15:39:11 +02:00
Jeroen van Rijn eaefbc43cb xxhash: Add XXH3_128 + test vectors. 2021-09-11 15:28:49 +02:00
Jeroen van Rijn f04614b1f1 Make -vet happy. 2021-09-09 16:05:59 +02:00
Jeroen van Rijn 637685316d Add xxhash tests to CI. 2021-09-09 16:01:44 +02:00
Jeroen van Rijn f16e98b074 Add xxhash benchmark. 2021-09-09 15:26:57 +02:00
Jeroen van Rijn f5d5417af7 xxhash: Initial implementations. 2021-09-09 15:26:57 +02:00