MCPcopy Create free account
hub / github.com/RustCrypto/utils / cmovnz

Method cmovnz

cmov/src/slice.rs:41–55  ·  view source on GitHub ↗
(&mut self, value: &Self, condition: Condition)

Source from the content-addressed store, hash-verified

39 #[inline]
40 #[track_caller]
41 fn cmovnz(&mut self, value: &Self, condition: Condition) {
42 assert_lengths_eq!(self.len(), value.len());
43
44 let (dst_chunks, dst_remainder) = slice_as_chunks_mut::<u8, WORD_SIZE>(self);
45 let (src_chunks, src_remainder) = slice_as_chunks::<u8, WORD_SIZE>(value);
46
47 for (dst_chunk, src_chunk) in dst_chunks.iter_mut().zip(src_chunks.iter()) {
48 let mut a = Word::from_ne_bytes(*dst_chunk);
49 let b = Word::from_ne_bytes(*src_chunk);
50 a.cmovnz(&b, condition);
51 dst_chunk.copy_from_slice(&a.to_ne_bytes());
52 }
53
54 cmovnz_remainder(dst_remainder, src_remainder, condition);
55 }
56}
57
58// Optimized implementation for slices of `u16` which coalesces them into word-sized chunks first,

Callers 1

cmovnz_remainderFunction · 0.45

Calls 2

cmovnz_remainderFunction · 0.85
zipMethod · 0.80

Tested by

no test coverage detected