enc_ssse3.c 562 B

12345678910111213141516171819202122
  1. // If we have SSSE3 support, pick off 12 bytes at a time for as long as we can.
  2. // But because we read 16 bytes at a time, ensure we have enough room to do a
  3. // full 16-byte read without segfaulting:
  4. while (srclen >= 16)
  5. {
  6. // Load string:
  7. __m128i str = _mm_loadu_si128((__m128i *)c);
  8. // Reshuffle:
  9. str = enc_reshuffle(str);
  10. // Translate reshuffled bytes to the Base64 alphabet:
  11. str = enc_translate(str);
  12. // Store:
  13. _mm_storeu_si128((__m128i *)o, str);
  14. c += 12; // 3 * 4 bytes of input
  15. o += 16; // 4 * 4 bytes of output
  16. outl += 16;
  17. srclen -= 12;
  18. }