GNU Radio 3.6.5 C++ API

volk_32u_popcnt_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_VOLK_32u_POPCNT_A16_H
00002 #define INCLUDED_VOLK_32u_POPCNT_A16_H
00003 
00004 #include <stdio.h>
00005 #include <inttypes.h>
00006 
00007 
00008 #ifdef LV_HAVE_GENERIC
00009 
00010 static inline void volk_32u_popcnt_a_generic(uint32_t* ret, const uint32_t value) {
00011 
00012   // This is faster than a lookup table
00013   uint32_t retVal = value;
00014 
00015   retVal = (retVal & 0x55555555) + (retVal >> 1 & 0x55555555);
00016   retVal = (retVal & 0x33333333) + (retVal >> 2 & 0x33333333);
00017   retVal = (retVal + (retVal >> 4)) & 0x0F0F0F0F;
00018   retVal = (retVal + (retVal >> 8));
00019   retVal = (retVal + (retVal >> 16)) & 0x0000003F;
00020 
00021   *ret = retVal;
00022 }
00023 
00024 #endif /*LV_HAVE_GENERIC*/
00025 
00026 #ifdef LV_HAVE_SSE4_2
00027 
00028 #include <nmmintrin.h>
00029 
00030 static inline void volk_32u_popcnt_a_sse4_2(uint32_t* ret, const uint32_t value) {
00031   *ret = _mm_popcnt_u32(value);
00032 }
00033 
00034 #endif /*LV_HAVE_SSE4_2*/
00035 
00036 #endif /*INCLUDED_VOLK_32u_POPCNT_A16_H*/