lang: have hasher_u32.update_u32 take a roslice

This commit is contained in:
Nigel Tao committed 2023-04-10 21:16:53 +10:00
1 parent ea3fbc37f5
commit 29c4122360
11 files changed
+68 -42

No files matched your search

+4 -4
View File
@@ -21,7 +21,7 @@ pub struct hasher? implements base.hasher_u32(
pub func hasher.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
}
pub func hasher.update_u32!(x: slice base.u8) base.u32 {
pub func hasher.update_u32!(x: roslice base.u8) base.u32 {
if not this.started {
this.started = true
this.state = 1
@@ -37,7 +37,7 @@ pub func hasher.update_u32!(x: slice base.u8) base.u32 {
return this.state
}
pri func hasher.up!(x: slice base.u8),
pri func hasher.up!(x: roslice base.u8),
choosy,
{
// The Adler-32 checksum's magic 65521 and 5552 numbers are discussed in
@@ -45,8 +45,8 @@ pri func hasher.up!(x: slice base.u8),
var s1 : base.u32
var s2 : base.u32
var remaining : slice base.u8
var p : slice base.u8
var remaining : roslice base.u8
var p : roslice base.u8
s1 = this.state.low_bits(n: 16)
s2 = this.state.high_bits(n: 16)