city_streaming.h 677 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <util/digest/city.h>
  3. /**
  4. * (partially) streaming version of CityHash64 for large data.
  5. * You need to know length and first/last 64 bytes.
  6. * Those bytes should be passed twice: in constructor and thru process().
  7. * Length must be STRICTLY larger than 64 bytes.
  8. * XXX: Dont use CityHash64 if you can use something else and need streaming
  9. */
  10. class TStreamingCityHash64 {
  11. ui64 x, y, z;
  12. std::pair<ui64, ui64> v, w;
  13. char UnalignBuf_[64];
  14. size_t UnalignBufSz_, Rest64_;
  15. public:
  16. TStreamingCityHash64(size_t len, const char* head64, const char* tail64);
  17. void Process(const char* s, size_t avail);
  18. ui64 operator()();
  19. };