Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do the same checks in codecs than in codec_choose #42

Merged
merged 1 commit into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/arch/avx/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../../../include/libbase64.h"
#include "../../codecs.h"

#ifdef __AVX__
#if HAVE_AVX
#include <immintrin.h>

#include "../sse2/compare_macros.h"
Expand All @@ -14,11 +14,11 @@
#include "../ssse3/enc_translate.c"
#include "../ssse3/enc_reshuffle.c"

#endif // __AVX__
#endif // HAVE_AVX

BASE64_ENC_FUNCTION(avx)
{
#ifdef __AVX__
#if HAVE_AVX
#include "../generic/enc_head.c"
#include "../ssse3/enc_loop.c"
#include "../generic/enc_tail.c"
Expand All @@ -29,7 +29,7 @@ BASE64_ENC_FUNCTION(avx)

BASE64_DEC_FUNCTION(avx)
{
#ifdef __AVX__
#if HAVE_AVX
#include "../generic/dec_head.c"
#include "../ssse3/dec_loop.c"
#include "../generic/dec_tail.c"
Expand Down
8 changes: 4 additions & 4 deletions lib/arch/avx2/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../../../include/libbase64.h"
#include "../../codecs.h"

#ifdef __AVX2__
#if HAVE_AVX2
#include <immintrin.h>

#define CMPGT(s,n) _mm256_cmpgt_epi8((s), _mm256_set1_epi8(n))
Expand Down Expand Up @@ -158,11 +158,11 @@ dec_reshuffle (__m256i in)
return _mm256_permutevar8x32_epi32(out, _mm256_setr_epi32(0, 1, 2, 4, 5, 6, -1, -1));
}

#endif // __AVX2__
#endif // HAVE_AVX2

BASE64_ENC_FUNCTION(avx2)
{
#ifdef __AVX2__
#if HAVE_AVX2
#include "../generic/enc_head.c"
#include "enc_loop.c"
#include "../generic/enc_tail.c"
Expand All @@ -173,7 +173,7 @@ BASE64_ENC_FUNCTION(avx2)

BASE64_DEC_FUNCTION(avx2)
{
#ifdef __AVX2__
#if HAVE_AVX2
#include "../generic/dec_head.c"
#include "dec_loop.c"
#include "../generic/dec_tail.c"
Expand Down
11 changes: 5 additions & 6 deletions lib/arch/neon32/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#ifdef __ARM_NEON__
#include <arm_neon.h>
#endif

#include "../../../include/libbase64.h"
#include "../../codecs.h"

#if (defined(__arm__) && defined(__ARM_NEON__))
#if (defined(__arm__) && defined(__ARM_NEON__) && HAVE_NEON32)

#include <arm_neon.h>

#define CMPGT(s,n) vcgtq_u8((s), vdupq_n_u8(n))
#define CMPEQ(s,n) vceqq_u8((s), vdupq_n_u8(n))
Expand Down Expand Up @@ -119,7 +118,7 @@ enc_translate (uint8x16x4_t in)

BASE64_ENC_FUNCTION(neon32)
{
#if (defined(__arm__) && defined(__ARM_NEON__))
#if (defined(__arm__) && defined(__ARM_NEON__) && HAVE_NEON32)
#include "../generic/enc_head.c"
#include "enc_loop.c"
#include "../generic/32/enc_loop.c"
Expand All @@ -131,7 +130,7 @@ BASE64_ENC_FUNCTION(neon32)

BASE64_DEC_FUNCTION(neon32)
{
#if (defined(__arm__) && defined(__ARM_NEON__))
#if (defined(__arm__) && defined(__ARM_NEON__) && HAVE_NEON32)
#include "../generic/dec_head.c"
#include "dec_loop.c"
#include "../generic/32/dec_loop.c"
Expand Down
10 changes: 4 additions & 6 deletions lib/arch/neon64/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#ifdef __ARM_NEON__
#include <arm_neon.h>
#endif

#include "../../../include/libbase64.h"
#include "../../codecs.h"

#if (defined(__aarch64__) && defined(__ARM_NEON__))
#if (defined(__aarch64__) && defined(__ARM_NEON__) && HAVE_NEON64)
#include <arm_neon.h>

#define CMPGT(s,n) vcgtq_u8((s), vdupq_n_u8(n))

Expand Down Expand Up @@ -90,7 +88,7 @@ static const uint8_t base64_dec_lut2[] =

BASE64_ENC_FUNCTION(neon64)
{
#if (defined(__aarch64__) && defined(__ARM_NEON__))
#if (defined(__aarch64__) && defined(__ARM_NEON__) && HAVE_NEON64)
const uint8x16x4_t tbl_enc = load_64byte_table(base64_table_enc);

#include "../generic/enc_head.c"
Expand All @@ -104,7 +102,7 @@ BASE64_ENC_FUNCTION(neon64)

BASE64_DEC_FUNCTION(neon64)
{
#if (defined(__aarch64__) && defined(__ARM_NEON__))
#if (defined(__aarch64__) && defined(__ARM_NEON__) && HAVE_NEON64)
const uint8x16x4_t tbl_dec1 = load_64byte_table(base64_dec_lut1);
const uint8x16x4_t tbl_dec2 = load_64byte_table(base64_dec_lut2);

Expand Down
8 changes: 4 additions & 4 deletions lib/arch/sse41/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../../../include/libbase64.h"
#include "../../codecs.h"

#ifdef __SSE4_1__
#if HAVE_SSE41
#include <smmintrin.h>

#include "../sse2/compare_macros.h"
Expand All @@ -14,11 +14,11 @@
#include "../ssse3/enc_translate.c"
#include "../ssse3/enc_reshuffle.c"

#endif // __SSE4_1__
#endif // HAVE_SSE41

BASE64_ENC_FUNCTION(sse41)
{
#ifdef __SSE4_1__
#if HAVE_SSE41
#include "../generic/enc_head.c"
#include "../ssse3/enc_loop.c"
#include "../generic/enc_tail.c"
Expand All @@ -29,7 +29,7 @@ BASE64_ENC_FUNCTION(sse41)

BASE64_DEC_FUNCTION(sse41)
{
#ifdef __SSE4_1__
#if HAVE_SSE41
#include "../generic/dec_head.c"
#include "../ssse3/dec_loop.c"
#include "../generic/dec_tail.c"
Expand Down
8 changes: 4 additions & 4 deletions lib/arch/sse42/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../../../include/libbase64.h"
#include "../../codecs.h"

#ifdef __SSE4_2__
#if HAVE_SSE42
#include <nmmintrin.h>

#include "../sse2/compare_macros.h"
Expand All @@ -14,11 +14,11 @@
#include "../ssse3/enc_translate.c"
#include "../ssse3/enc_reshuffle.c"

#endif // __SSE4_2__
#endif // HAVE_SSE42

BASE64_ENC_FUNCTION(sse42)
{
#ifdef __SSE4_2__
#if HAVE_SSE42
#include "../generic/enc_head.c"
#include "../ssse3/enc_loop.c"
#include "../generic/enc_tail.c"
Expand All @@ -29,7 +29,7 @@ BASE64_ENC_FUNCTION(sse42)

BASE64_DEC_FUNCTION(sse42)
{
#ifdef __SSE4_2__
#if HAVE_SSE42
#include "../generic/dec_head.c"
#include "../ssse3/dec_loop.c"
#include "../generic/dec_tail.c"
Expand Down
8 changes: 4 additions & 4 deletions lib/arch/ssse3/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../../../include/libbase64.h"
#include "../../codecs.h"

#ifdef __SSSE3__
#if HAVE_SSSE3
#include <tmmintrin.h>

#include "../sse2/compare_macros.h"
Expand All @@ -14,11 +14,11 @@
#include "enc_reshuffle.c"
#include "enc_translate.c"

#endif // __SSSE3__
#endif // HAVE_SSSE3

BASE64_ENC_FUNCTION(ssse3)
{
#ifdef __SSSE3__
#if HAVE_SSSE3
#include "../generic/enc_head.c"
#include "enc_loop.c"
#include "../generic/enc_tail.c"
Expand All @@ -29,7 +29,7 @@ BASE64_ENC_FUNCTION(ssse3)

BASE64_DEC_FUNCTION(ssse3)
{
#ifdef __SSSE3__
#if HAVE_SSSE3
#include "../generic/dec_head.c"
#include "dec_loop.c"
#include "../generic/dec_tail.c"
Expand Down