Some checks are pending
docs / build-and-deploy (push) Waiting to run
Add `long`, a 64-bit signed integer primitive (i64), threaded through codegen: llty; int<->long coercion (coerce_code/to_long) at let/assign/ return/call-args; i64 arithmetic + comparison promotion in emit_bin; unary negate/~; print via %lld and str()/interpolation via @fn_long_str. Editor vocabulary (syntax header, TextMate grammar, formatter, LSP) synced; check-vocabulary green. Numeric literals stay i32 — build large values by widening (documented on the type page). Complete the Hash.* namespace (issue #17) with both 32- and 64-bit algorithms: Hash.of/fnv1a/crc32/mix/combine (32-bit) and Hash.of64/fnv1a_64/mix64 (64-bit, returning long). Deterministic and C-free; CRC-32 (poly 0xEDB88320) and FNV vectors verified against reference implementations. Tests: selfhost/tests/{hash,long}.ludic. Docs: docs/language/hash/*, type-long.md. Seed reseeded; C-free bootstrap fixpoint holds; 23 selfhost + 45 regression + 29 tooling checks green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
937 B
Markdown
28 lines
937 B
Markdown
---
|
|
id: hash-of64
|
|
name: Hash.of64
|
|
category: hash
|
|
kind: namespace-method
|
|
tokens: Hash.of64
|
|
sig: Hash.of64(s) -> long
|
|
tip: The fast default 64-bit string hash.
|
|
order: 6
|
|
ns: Hash
|
|
member: of64
|
|
---
|
|
|
|
The 64-bit counterpart of <a href="hash-of"><code>Hash.of</code></a>: hashes a string to a <code>long</code> instead of a 32-bit <code>int</code>. Use it when you want far fewer collisions than 32 bits can give — large content-id spaces, asset registries, or network identifiers where two different strings sharing a hash would be a real risk. Currently it is <a href="hash-fnv1a_64"><code>Hash.fnv1a_64</code></a>, FNV-1a over the bytes. Deterministic like every hash here: the same string always gives the same 64-bit value.
|
|
|
|
Parameters:
|
|
- `s` — the string to hash
|
|
|
|
```ludic
|
|
program Ids64 {
|
|
entry {
|
|
let grass: long = Hash.of64("grass_tile")
|
|
let water: long = Hash.of64("water_tile")
|
|
print(grass)
|
|
print(water)
|
|
}
|
|
}
|
|
```
|