@@ -12,29 +12,41 @@ mod simdty;
12
12
13
13
pub use self :: simdty:: { u32x4, u64x4} ;
14
14
15
+ /// SIMD vector operations for 4-element vectors used in Blake2 compression.
15
16
pub trait Vector4 < T > : Copy {
17
+ /// Gather elements from a slice at specified indices into a 4-element vector.
16
18
fn gather ( src : & [ T ] , i0 : usize , i1 : usize , i2 : usize , i3 : usize ) -> Self ;
17
19
20
+ /// Convert from little-endian byte order (no-op on little-endian targets).
18
21
#[ allow( clippy:: wrong_self_convention) ]
19
22
fn from_le ( self ) -> Self ;
23
+ /// Convert to little-endian byte order (no-op on little-endian targets).
20
24
fn to_le ( self ) -> Self ;
21
25
26
+ /// Wrapping addition of two vectors.
22
27
fn wrapping_add ( self , rhs : Self ) -> Self ;
23
28
29
+ /// Rotate all elements right by a constant number of bits.
24
30
fn rotate_right_const ( self , n : u32 ) -> Self ;
25
31
32
+ /// Shuffle elements left by 1 position: \[a,b,c,d\] -> \[b,c,d,a\].
26
33
fn shuffle_left_1 ( self ) -> Self ;
34
+ /// Shuffle elements left by 2 positions: \[a,b,c,d\] -> \[c,d,a,b\].
27
35
fn shuffle_left_2 ( self ) -> Self ;
36
+ /// Shuffle elements left by 3 positions: \[a,b,c,d\] -> \[d,a,b,c\].
28
37
fn shuffle_left_3 ( self ) -> Self ;
29
38
39
+ /// Shuffle elements right by 1 position: \[a,b,c,d\] -> \[d,a,b,c\].
30
40
#[ inline( always) ]
31
41
fn shuffle_right_1 ( self ) -> Self {
32
42
self . shuffle_left_3 ( )
33
43
}
44
+ /// Shuffle elements right by 2 positions: \[a,b,c,d\] -> \[c,d,a,b\].
34
45
#[ inline( always) ]
35
46
fn shuffle_right_2 ( self ) -> Self {
36
47
self . shuffle_left_2 ( )
37
48
}
49
+ /// Shuffle elements right by 3 positions: \[a,b,c,d\] -> \[b,c,d,a\].
38
50
#[ inline( always) ]
39
51
fn shuffle_right_3 ( self ) -> Self {
40
52
self . shuffle_left_1 ( )
0 commit comments