_compat.c 848 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "upstream/xxhash.h"
  2. #include <stdio.h>
  3. int main() {
  4. unsigned char buf[4096];
  5. for (int i = 0; i < 4096; i++) {
  6. buf[i] = (unsigned char)((i+1)%251);
  7. }
  8. printf("var testVecs64 = []uint64{\n");
  9. for (int i = 0; i < 4096; i++) {
  10. if (i % 4 == 0) {
  11. printf("\t");
  12. }
  13. uint64_t h = XXH3_64bits(buf, (size_t)i);
  14. printf("0x%lx, ", h);
  15. if (i % 4 == 3) {
  16. printf("\n\t");
  17. }
  18. }
  19. printf("}\n\n");
  20. printf("var testVecs128 = [][2]uint64{\n");
  21. for (int i = 0; i < 4096; i++) {
  22. if (i % 4 == 0) {
  23. printf("\t");
  24. }
  25. XXH128_hash_t h = XXH3_128bits(buf, (size_t)i);
  26. printf("{0x%lx, 0x%lx}, ", h.high64, h.low64);
  27. if (i % 4 == 3) {
  28. printf("\n");
  29. }
  30. }
  31. printf("}\n\n");
  32. }