aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/binary_hamming_distance.h
blob: 84bbbe71788805c25e3377195a7d310ca20b4adc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <cstddef>
namespace vespalib {
/**
 * Compute Hamming distance between two binary blobs
 *
 * @param lhs a blob (to interpret as a bitvector with sz*8 bits)
 * @param rhs a blob (to interpret as a bitvector with sz*8 bits)
 * @param sz number of bytes in each blob
 * @return number of bits that differ when comparing the two blobs
 **/
size_t binary_hamming_distance(const void *lhs, const void *rhs, size_t sz);
}