File: siphash_impl.h

package info (click to toggle)
siphashc 1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 108 kB
  • sloc: ansic: 209; python: 91; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef SIPHASH_IMPL_H
#define SIPHASH_IMPL_H

#include "siphash.h"

#if defined(_MSC_VER)
    #include <intrin.h>

    #define INLINE __forceinline
    #define NOINLINE __declspec(noinline)
    #define ROTL64(a,b) _rotl64(a,b)
    #define MM16 __declspec(align(16))

    typedef unsigned int uint32_t;

    #if (_MSC_VER >= 1500)
        #define __SSSE3__
    #endif
    #if (_MSC_VER > 1200) || defined(_mm_free)
        #define __SSE2__
    #endif
#else
    #define INLINE inline __attribute__((always_inline))
    #define NOINLINE __attribute__((noinline))
    #define ROTL64(a,b) (((a)<<(b))|((a)>>(64-b)))
    #define MM16 __attribute__((aligned(16)))
#endif

#define FALLTHROUGH
#if defined(__clang__)
#  if defined(__has_cpp_attribute)
#    if __has_cpp_attribute(clang::fallthrough)
#      undef FALLTHROUGH
#      define FALLTHROUGH [[clang::fallthrough]]
#    endif
#  endif
#elif defined(__GNUC__)
#undef FALLTHROUGH
#define FALLTHROUGH __attribute__ ((fallthrough))
#endif

#if defined(__SSE2__)
    #include <emmintrin.h>
    typedef __m128i xmmi;
    typedef __m64 qmm;

    typedef union packedelem64_t {
        uint64_t u[2];
        xmmi v;
    } packedelem64;

    typedef union packedelem8_t {
        unsigned char u[16];
        xmmi v;
    } packedelem8;
#endif

#if defined(__SSSE3__)
    #include <tmmintrin.h>
#endif

#endif // SIPHASH_IMPL_H