This commit is contained in:
Connor 2017-05-16 21:02:45 -07:00 committed by GitHub
parent ef338fea75
commit 309749f0db

View file

@ -1,17 +1,8 @@
#ifdef _WIN64
#define FMT64 "%016I64X"
#else
#ifdef __unix
#define FMT64 "%016lX"
#else
#define FMT64 "%016llX"
#endif
#endif
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
typedef uint8_t u8; typedef uint8_t u8;
typedef uint32_t u32; typedef uint32_t u32;
@ -77,14 +68,14 @@ int main(int argc, char **argv) {
if (argc == 1) { if (argc == 1) {
const char str[] = "IseeDeadPeople"; const char str[] = "IseeDeadPeople";
u64 hash = wc3hashC(str); u64 hash = wc3hashC(str);
fprintf(stderr, FMT64 " should equal 701EA16D47F385FC\n", hash); fprintf(stderr, "%" PRIX64 " should equal 701EA16D47F385FC\n", hash);
return hash != 0x701EA16D47F385FC; return hash != 0x701EA16D47F385FC;
} }
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
u64 hash = wc3hashC(argv[i]); u64 hash = wc3hashC(argv[i]);
u32 hash32 = (hash >> 32) ^ hash; u32 hash32 = (hash >> 32) ^ hash;
printf(FMT64 "\t%08X\n", hash, hash32); printf("%" PRIX64 "\t%08X\n", hash, hash32);
} }
return 0; return 0;
} }