]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - lib/crc32.c
Merge git://git.denx.de/u-boot-rockchip
[people/ms/u-boot.git] / lib / crc32.c
index 76205da4f3060028508d4f39974b673ea52c898a..7f545fde4a0225c5b7614942f5839d99e5f8e784 100644 (file)
@@ -8,7 +8,9 @@
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
-#ifndef USE_HOSTCC
+#ifdef USE_HOSTCC
+#include <arpa/inet.h>
+#else
 #include <common.h>
 #endif
 #include <compiler.h>
@@ -24,7 +26,7 @@
 
 #define tole(x) cpu_to_le32(x)
 
-#ifdef DYNAMIC_CRC_TABLE
+#ifdef CONFIG_DYNAMIC_CRC_TABLE
 
 local int crc_table_empty = 1;
 local uint32_t crc_table[256];
@@ -155,7 +157,7 @@ tole(0xb40bbe37L), tole(0xc30c8ea1L), tole(0x5a05df1bL), tole(0x2d02ef8dL)
  */
 const uint32_t * ZEXPORT get_crc_table()
 {
-#ifdef DYNAMIC_CRC_TABLE
+#ifdef CONFIG_DYNAMIC_CRC_TABLE
   if (crc_table_empty) make_crc_table();
 #endif
   return (const uint32_t *)crc_table;
@@ -179,7 +181,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
     const uint32_t *tab = crc_table;
     const uint32_t *b =(const uint32_t *)buf;
     size_t rem_len;
-#ifdef DYNAMIC_CRC_TABLE
+#ifdef CONFIG_DYNAMIC_CRC_TABLE
     if (crc_table_empty)
       make_crc_table();
 #endif
@@ -256,5 +258,6 @@ void crc32_wd_buf(const unsigned char *input, unsigned int ilen,
        uint32_t crc;
 
        crc = crc32_wd(0, input, ilen, chunk_sz);
+       crc = htonl(crc);
        memcpy(output, &crc, sizeof(crc));
 }