diff --git a/openair1/PHY/CODING/crc.h b/openair1/PHY/CODING/crc.h index c31366765f63beaae17afd0f1033793e6c912bb9..d6474eae9b7e49405724abccd147063a2b92c272 100644 --- a/openair1/PHY/CODING/crc.h +++ b/openair1/PHY/CODING/crc.h @@ -44,6 +44,8 @@ #include "crcext.h" #include "types.h" +#include <immintrin.h> +#include <wmmintrin.h> /** * PCLMULQDQ CRC computation context structure diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index af3ca1f8856c3cc31bead4ddb6c208727f93ab8b..d2b8f2e2d33a703ab280fcc1f413b7324ad98980 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -30,13 +30,10 @@ Modified in June, 2001, to include the length non multiple of 8 */ -#define USE_INTEL_CRC 1 #include "coding_defs.h" #include "assertions.h" -#ifdef USE_INTEL_CRC #include "crc.h" -#endif /*ref 36-212 v8.6.0 , pp 8-9 */ /* the highest degree is set by default */ @@ -97,7 +94,6 @@ static unsigned short crc11Table[256]; static unsigned char crc8Table[256]; static unsigned char crc6Table[256]; -#ifdef USE_INTEL_CRC static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq, 16) = { 0x64e4d700, /**< k1 */ 0x2c8c9d00, /**< k2 */ @@ -117,7 +113,6 @@ DECLARE_ALIGNED(const uint8_t crc_xmm_shift_tab[48], 16) = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -#endif void crcTableInit (void) { @@ -133,11 +128,10 @@ void crcTableInit (void) crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24); crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24); } while (++c); -#ifdef USE_INTEL_CRC - crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b, - 0x04050607, 0x00010203); + if (__builtin_cpu_supports ("pclmul")) + crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b, + 0x04050607, 0x00010203); -#endif } /********************************************************* @@ -171,7 +165,6 @@ unsigned int crc24a (unsigned char * inptr, } -#ifdef USE_INTEL_CRC static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24b_pclmulqdq, 16) = { 0x80140500, /**< k1 */ 0x42000100, /**< k2 */ @@ -180,7 +173,6 @@ static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24b_pclmulqdq, 16) = { 0x80006300, /**< p */ 0ULL /**< res */ }; -#endif unsigned int crc24b (unsigned char * inptr, int bitlen) {