/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Copied from uniffi_core/src/metadata.rs // Due to a [Rust bug](https://github.com/rust-lang/rust/issues/113104) we don't want to pull in // `uniffi_core`. // This is the easy way out of that issue and is a temporary hacky solution.
// Create a checksum for a MetadataBuffer // // This is used by the bindings code to verify that the library they link to is the same one // that the bindings were generated from. pubconstfn checksum_metadata(buf: &[u8]) -> u16 {
calc_checksum(buf, buf.len())
}
constfn calc_checksum(bytes: &[u8], size: usize) -> u16 { // Taken from the fnv_hash() function from the FNV crate (https://github.com/servo/rust-fnv/blob/master/lib.rs). // fnv_hash() hasn't been released in a version yet. const INITIAL_STATE: u64 = 0xcbf29ce484222325; const PRIME: u64 = 0x100000001b3;
letmut hash = INITIAL_STATE; letmut i = 0; while i < size {
hash ^= bytes[i] as u64;
hash = hash.wrapping_mul(PRIME);
i += 1;
} // Convert the 64-bit hash to a 16-bit hash by XORing everything together
(hash ^ (hash >> 16) ^ (hash >> 32) ^ (hash >> 48)) as u16
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.