/**
@file     file_path_tools.h
@brief    Various hashes with well known performance characteristics
@details  Copyright (c) 2025 Acronis International GmbH
@author   Denis Kopyrin (denis.kopyrin@acronis.com)
@since    $Id: $
*/

#pragma once

#ifdef KERNEL_MOCK
#include "mock/mock.h"
#endif
#include <linux/types.h>

static inline uint64_t moremur(uint64_t x)
{
  x ^= x >> 27;
  x *= 0x3C79AC492BA7B653UL;
  x ^= x >> 33;
  x *= 0x1C69B3F74AC4AE35UL;
  x ^= x >> 27;

  return x;
}

static inline uint64_t moremur_hash(uint64_t val, unsigned int bits)
{
  return moremur(val) >> (64 - bits);
}

uint64_t murmur_hash(const void * key, int len) __attribute__((pure));
