美文网首页
2020-04-01 SSE4.2 #include

2020-04-01 SSE4.2 #include

作者: 阿群1986 | 来源:发表于2020-04-01 19:30 被阅读0次
    #ifndef __SSE4_2__
    #pragma GCC push_options
    #pragma GCC target("sse4.2")
    #define __DISABLE_SSE4_2__
    #endif /* __SSE4_1__ */
    
    /* Accumulate CRC32 (polynomial 0x11EDC6F41) value.  */
    extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
    _mm_crc32_u8 (unsigned int __C, unsigned char __V)
    {
      return __builtin_ia32_crc32qi (__C, __V);
    }
    
    extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
    _mm_crc32_u16 (unsigned int __C, unsigned short __V)
    {
      return __builtin_ia32_crc32hi (__C, __V);
    }
    
    extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
    _mm_crc32_u32 (unsigned int __C, unsigned int __V)
    {
      return __builtin_ia32_crc32si (__C, __V);
    }
    
    #ifdef __x86_64__
    extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
    _mm_crc32_u64 (unsigned long long __C, unsigned long long __V)
    {
      return __builtin_ia32_crc32di (__C, __V);
    }
    #endif
    
    #ifdef __DISABLE_SSE4_2__
    #undef __DISABLE_SSE4_2__
    #pragma GCC pop_options
    #endif /* __DISABLE_SSE4_2__ */
    

    相关文章

      网友评论

          本文标题:2020-04-01 SSE4.2 #include

          本文链接:https://www.haomeiwen.com/subject/jutzuhtx.html