chromium/third_party/zlib/slide_hash_simd.h

/* slide_hash_simd.h
 *
 * Copyright 2022 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the Chromium source repository LICENSE file.
 */

#ifndef SLIDE_HASH_SIMD_H
#define SLIDE_HASH_SIMD_H

#include "deflate.h"

#ifndef INLINE
#if defined(_MSC_VER) && !defined(__clang__)
#define INLINE
#else
#define INLINE
#endif
#endif

#if defined(CPU_NO_SIMD)

#error SIMD has been disabled for your build target

#elif defined(DEFLATE_SLIDE_HASH_SSE2)

#include <emmintrin.h>  /* SSE2 */

#define Z_SLIDE_INIT_SIMD

#define Z_SLIDE_HASH_SIMD

z_vec128i_u16x8_t;

#elif defined(DEFLATE_SLIDE_HASH_NEON)

#include <arm_neon.h>  /* NEON */

#define Z_SLIDE_INIT_SIMD

#define Z_SLIDE_HASH_SIMD

typedef uint16x8_t z_vec128i_u16x8_t;

#else

#error slide_hash_simd is not defined for your build target

#endif

/* ===========================================================================
 * Slide the hash table when sliding the window down (could be avoided with 32
 * bit values at the expense of memory usage). We slide even when level == 0 to
 * keep the hash table consistent if we switch back to level > 0 later.
 */
local INLINE void slide_hash_simd(
    Posf *head, Posf *prev, const uInt w_size, const uInt hash_size) {}

#undef z_vec128i_u16x8_t
#undef Z_SLIDE_HASH_SIMD
#undef Z_SLIDE_INIT_SIMD

#endif  /* SLIDE_HASH_SIMD_H */