Browse code

Optimize crc64 table generation.

Steve Morgan authored on 2013/10/10 06:18:27
Showing 1 changed files
... ...
@@ -23,6 +23,7 @@
23 23
 #endif
24 24
 
25 25
 #include "7z/LzmaDec.h"
26
+#include "7z/XzCrc64.h"
26 27
 #include "xz_iface.h"
27 28
 
28 29
 void *__xz_wrap_alloc(void *unused, size_t size) { 
... ...
@@ -59,7 +60,8 @@ static unsigned char xz_getbyte(struct CLI_XZ *L, int *fail) {
59 59
 int cli_XzInit(struct CLI_XZ *XZ) {
60 60
     if (SZ_OK != XzUnpacker_Create(&XZ->state, &g_Alloc))
61 61
         return XZ_RESULT_DATA_ERROR;
62
-    Crc64GenerateTable();
62
+    if (g_Crc64Table[1] == 0)
63
+        Crc64GenerateTable();
63 64
     return XZ_RESULT_OK;
64 65
 }
65 66