mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
The LICENSE has changed from a single license (Apache2) to a dual license (Apache2 or MIT, at your option). If you've previously used Wuffs under the Apache2 license, you are able to keep doing so. No further action required by you. The two files listed below (previous releases) are exceptions, as they are older snapshots, frozen in time. Their license has not changed: release/c/wuffs-v0.2.c release/c/wuffs-v0.3.c Every name in the AUTHORS file, other than Google Inc., has signed Google's CLA (Contributor License Agreement).
33 lines
1021 B
Plaintext
33 lines
1021 B
Plaintext
// Copyright 2021 The Wuffs Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
pri func ieee_hasher.up_arm_crc32!(x: roslice base.u8),
|
|
choose cpu_arch >= arm_crc32,
|
|
{
|
|
var p : roslice base.u8
|
|
|
|
var util : base.arm_crc32_utility
|
|
var s : base.arm_crc32_u32
|
|
|
|
s = util.make_u32(a: 0xFFFF_FFFF ^ this.state)
|
|
|
|
// Align to a 16-byte boundary.
|
|
while (args.x.length() > 0) and ((15 & args.x.uintptr_low_12_bits()) <> 0) {
|
|
s = s.crc32b(b: args.x[0])
|
|
args.x = args.x[1 ..]
|
|
} endwhile
|
|
|
|
iterate (p = args.x)(length: 8, advance: 8, unroll: 16) {
|
|
s = s.crc32d(b: p.peek_u64le())
|
|
} else (length: 1, advance: 1, unroll: 1) {
|
|
s = s.crc32b(b: p[0])
|
|
}
|
|
|
|
this.state = 0xFFFF_FFFF ^ s.value()
|
|
}
|