Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains basic functions for compression/uncompression. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_SUPPORT_COMPRESSION_H |
| 15 | #define LLVM_SUPPORT_COMPRESSION_H |
| 16 | |
| 17 | #include "llvm/Support/DataTypes.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | template <typename T> class SmallVectorImpl; |
| 21 | class Error; |
| 22 | class StringRef; |
| 23 | |
| 24 | namespace zlib { |
| 25 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame^] | 26 | static constexpr int NoCompression = 0; |
| 27 | static constexpr int BestSpeedCompression = 1; |
| 28 | static constexpr int DefaultCompression = 6; |
| 29 | static constexpr int BestSizeCompression = 9; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 30 | |
| 31 | bool isAvailable(); |
| 32 | |
| 33 | Error compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame^] | 34 | int Level = DefaultCompression); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 35 | |
| 36 | Error uncompress(StringRef InputBuffer, char *UncompressedBuffer, |
| 37 | size_t &UncompressedSize); |
| 38 | |
| 39 | Error uncompress(StringRef InputBuffer, |
| 40 | SmallVectorImpl<char> &UncompressedBuffer, |
| 41 | size_t UncompressedSize); |
| 42 | |
| 43 | uint32_t crc32(StringRef Buffer); |
| 44 | |
| 45 | } // End of namespace zlib |
| 46 | |
| 47 | } // End of namespace llvm |
| 48 | |
| 49 | #endif |