/
githubmirror
/
nvme-cli
Обзор
Документация
Войти
/
githubmirror
/
nvme-cli
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/hash-util.h
25 строк
578 B
Martin Belanger
shared: rename everything to the shr_ namespace
28 июл 2026, 10:55
28 июл 2026, 10:55
8876cbc
Код
Авторство
О чём код?
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* * This file is part of nvme-cli. * Copyright (c) 2026 Dell Technologies Inc. or its subsidiaries. * * Authors: Martin Belanger <martin.belanger@dell.com> */ #pragma once #include <stddef.h> #include <stdint.h> /* FNV-1a 64-bit over a byte range: fast and dependency-free. */ static inline uint64_t shr_fnv1a_64(const void *buf, size_t len) { const unsigned char *p = buf; uint64_t hash = 14695981039346656037ULL; size_t i; for (i = 0; i < len; i++) { hash ^= p[i]; hash *= 1099511628211ULL; } return hash; }