MCPcopy Index your code
hub / github.com/RustPython/RustPython / _compute_hash

Method _compute_hash

crates/vm/src/builtins/str.rs:647–654  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

645
646 #[cold]
647 fn _compute_hash(&self, vm: &VirtualMachine) -> hash::PyHash {
648 let hash_val = vm.state.hash_secret.hash_bytes(self.as_bytes());
649 debug_assert_ne!(hash_val, hash::SENTINEL);
650 // spell-checker:ignore cmpxchg
651 // like with char_len, we don't need a cmpxchg loop, since it'll always be the same value
652 self.hash.store(hash_val, atomic::Ordering::Relaxed);
653 hash_val
654 }
655
656 #[inline]
657 pub fn byte_len(&self) -> usize {

Callers 1

hashMethod · 0.80

Calls 3

hash_bytesMethod · 0.80
as_bytesMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected