hash_ops.cpp 667 B

1234567891011121314151617181920212223
  1. #include "lchash.h"
  2. #include "lciter.h"
  3. #include "hash_ops.h"
  4. #include <util/generic/algorithm.h>
  5. size_t TCIOps::operator()(const TStringBuf& s) const noexcept {
  6. return FnvCaseLess(s, (size_t)0xBEE);
  7. }
  8. size_t TCIOps::operator()(const char* s) const noexcept {
  9. return operator()(TStringBuf(s));
  10. }
  11. bool TCIOps::operator()(const TStringBuf& f, const TStringBuf& s) const noexcept {
  12. using TIter = TLowerCaseIterator<const char>;
  13. return (f.size() == s.size()) && Equal(TIter(f.begin()), TIter(f.end()), TIter(s.begin()));
  14. }
  15. bool TCIOps::operator()(const char* f, const char* s) const noexcept {
  16. return operator()(TStringBuf(f), TStringBuf(s));
  17. }