aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/lower_case/hash_ops.cpp
blob: cdf08a44273a58b0f541a98d668178fe430c53ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "lchash.h"
#include "lciter.h"
#include "hash_ops.h"

#include <util/generic/algorithm.h>

size_t TCIOps::operator()(const TStringBuf& s) const noexcept {
    return FnvCaseLess(s, (size_t)0xBEE);
}

size_t TCIOps::operator()(const char* s) const noexcept {
    return operator()(TStringBuf(s));
}

bool TCIOps::operator()(const TStringBuf& f, const TStringBuf& s) const noexcept {
    using TIter = TLowerCaseIterator<const char>;

    return (f.size() == s.size()) && Equal(TIter(f.begin()), TIter(f.end()), TIter(s.begin())); 
}

bool TCIOps::operator()(const char* f, const char* s) const noexcept {
    return operator()(TStringBuf(f), TStringBuf(s));
}