소스 검색

hash becomes mishmash and move to codedweller namespace

master
madscientist 5 년 전
부모
커밋
57459a5d9a
2개의 변경된 파일8개의 추가작업 그리고 8개의 파일을 삭제
  1. 5
    5
      mishmash.cpp
  2. 3
    3
      mishmash.hpp

+ 5
- 5
mishmash.cpp 파일 보기

@@ -48,7 +48,7 @@ namespace codedweller {
inline uint32_t selectedPrime(size_t n) noexcept { return primes[mod256(n)]; }

uint32_t hash(const unsigned char* buffer, size_t length) noexcept {
uint32_t mishmash(const unsigned char* buffer, size_t length) noexcept {
uint64_t accumulator = selectedPrime(length);
for(size_t index = 0; index < length; index++) {
unsigned char byte = buffer[index];
@@ -60,12 +60,12 @@ namespace codedweller {
return accumulator & 0x00000000ffffffff;
}

uint32_t hash(const std::string& s) noexcept {
return hash((const unsigned char*) s.c_str(), s.length());
uint32_t mishmash(const std::string& s) noexcept {
return mishmash((const unsigned char*) s.c_str(), s.length());
}

uint32_t hash(const std::vector<unsigned char>& v) noexcept {
return hash(v.data(), v.size());
uint32_t mishmash(const std::vector<unsigned char>& v) noexcept {
return mishmash(v.data(), v.size());
}

}

+ 3
- 3
mishmash.hpp 파일 보기

@@ -7,8 +7,8 @@

namespace codedweller {

uint32_t hash(const unsigned char* buffer, size_t length) noexcept;
uint32_t hash(const std::string &s) noexcept;
uint32_t hash(const std::vector<unsigned char>& v) noexcept;
uint32_t mishmash(const unsigned char* buffer, size_t length) noexcept;
uint32_t mishmash(const std::string &s) noexcept;
uint32_t mishmash(const std::vector<unsigned char>& v) noexcept;

}

Loading…
취소
저장