crypto-native: use and instead of blend 46/25046/2
authorDamjan Marion <dmarion@me.com>
Wed, 12 Feb 2020 17:25:39 +0000 (18:25 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 12 Feb 2020 19:10:55 +0000 (19:10 +0000)
Faster and more portable...

Type: improvement

Change-Id: I915f8d3c45d1ba76ddfdbfac98482b04c98d148b
Signed-off-by: Damjan Marion <dmarion@me.com>
src/plugins/crypto_native/aes.h

index 01298cd..aacbf8a 100644 (file)
@@ -73,10 +73,7 @@ aes_block_store (u8 * p, u8x16 r)
 static_always_inline u8x16
 aes_byte_mask (u8x16 x, u8 n_bytes)
 {
-  u8x16 mask = u8x16_is_greater (u8x16_splat (n_bytes), byte_mask_scale);
-  __m128i zero = { };
-
-  return (u8x16) _mm_blendv_epi8 (zero, (__m128i) x, (__m128i) mask);
+  return x & u8x16_is_greater (u8x16_splat (n_bytes), byte_mask_scale);
 }
 
 static_always_inline u8x16