@@ -9,13 +9,15 @@ macro_rules! impl_to_bytes {
99 {
1010 /// Return the memory representation of this integer as a byte array in native byte
1111 /// order.
12+ #[ inline]
1213 pub fn to_ne_bytes( self ) -> crate :: simd:: Simd <u8 , { { $size * LANES } } > {
1314 // Safety: transmuting between vectors is safe
1415 unsafe { core:: mem:: transmute_copy( & self ) }
1516 }
1617
1718 /// Return the memory representation of this integer as a byte array in big-endian
1819 /// (network) byte order.
20+ #[ inline]
1921 pub fn to_be_bytes( self ) -> crate :: simd:: Simd <u8 , { { $size * LANES } } > {
2022 let bytes = self . to_ne_bytes( ) ;
2123 if cfg!( target_endian = "big" ) {
@@ -27,6 +29,7 @@ macro_rules! impl_to_bytes {
2729
2830 /// Return the memory representation of this integer as a byte array in little-endian
2931 /// byte order.
32+ #[ inline]
3033 pub fn to_le_bytes( self ) -> crate :: simd:: Simd <u8 , { { $size * LANES } } > {
3134 let bytes = self . to_ne_bytes( ) ;
3235 if cfg!( target_endian = "little" ) {
@@ -38,12 +41,14 @@ macro_rules! impl_to_bytes {
3841
3942 /// Create a native endian integer value from its memory representation as a byte array
4043 /// in native endianness.
44+ #[ inline]
4145 pub fn from_ne_bytes( bytes: crate :: simd:: Simd <u8 , { { $size * LANES } } >) -> Self {
4246 // Safety: transmuting between vectors is safe
4347 unsafe { core:: mem:: transmute_copy( & bytes) }
4448 }
4549
4650 /// Create an integer value from its representation as a byte array in big endian.
51+ #[ inline]
4752 pub fn from_be_bytes( bytes: crate :: simd:: Simd <u8 , { { $size * LANES } } >) -> Self {
4853 let bytes = if cfg!( target_endian = "big" ) {
4954 bytes
@@ -54,6 +59,7 @@ macro_rules! impl_to_bytes {
5459 }
5560
5661 /// Create an integer value from its representation as a byte array in little endian.
62+ #[ inline]
5763 pub fn from_le_bytes( bytes: crate :: simd:: Simd <u8 , { { $size * LANES } } >) -> Self {
5864 let bytes = if cfg!( target_endian = "little" ) {
5965 bytes
0 commit comments