]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - cmd/zstd/enzstd.c
Get rid of endian.h dependency
[tofuproxy.git] / cmd / zstd / enzstd.c
index 33f0b8d791a3b85d7fef949a8f94b414b92f7748..6dbbe985a6367080b0384a4a89151e512210d78e 100644 (file)
@@ -1,6 +1,6 @@
 /*
 enzstd -- .warc.zst compressor
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2021-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -18,7 +18,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/endian.h>
 
 #include <zstd.h>
 
@@ -70,7 +69,10 @@ main(int argc, char **argv)
             perror("can not fread(stdin)");
             goto Exit;
         }
-        srcWantSize = (size_t)be64dec(src);
+        srcWantSize = ((uint64_t)(src[0]) << 56) | ((uint64_t)(src[1]) << 48) |
+                      ((uint64_t)(src[2]) << 40) | ((uint64_t)(src[3]) << 32) |
+                      ((uint64_t)(src[4]) << 24) | ((uint64_t)(src[5]) << 16) |
+                      ((uint64_t)(src[6]) << 8) | (uint64_t)(src[7]);
         if (srcWantSize > srcSize) {
             free(src);
             srcSize = srcWantSize;