瀏覽代碼

LibCompress: Decrease CanonicalCode's size on stack

This commit stores the bit codes as u16s instead of u32s as the
maximum code bit length in DEFLATE is 15.
Idan Horowitz 4 年之前
父節點
當前提交
02b4cb96f8
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Userland/Libraries/LibCompress/Deflate.h

+ 4 - 4
Userland/Libraries/LibCompress/Deflate.h

@@ -49,12 +49,12 @@ public:
 
 
 private:
 private:
     // Decompression - indexed by code
     // Decompression - indexed by code
-    Vector<u32> m_symbol_codes;
-    Vector<u32> m_symbol_values;
+    Vector<u16> m_symbol_codes;
+    Vector<u16> m_symbol_values;
 
 
     // Compression - indexed by symbol
     // Compression - indexed by symbol
-    Array<u32, 288> m_bit_codes {}; // deflate uses a maximum of 288 symbols (maximum of 32 for distances)
-    Array<u32, 288> m_bit_code_lengths {};
+    Array<u16, 288> m_bit_codes {}; // deflate uses a maximum of 288 symbols (maximum of 32 for distances)
+    Array<u16, 288> m_bit_code_lengths {};
 };
 };
 
 
 class DeflateDecompressor final : public InputStream {
 class DeflateDecompressor final : public InputStream {