1 //===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains basic functions for compression/uncompression.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_SUPPORT_COMPRESSION_H
15 #define LLVM_SUPPORT_COMPRESSION_H
17 #include "llvm/Support/DataTypes.h"
22 template<typename T> class OwningPtr;
27 enum CompressionLevel {
36 StatusUnsupported, // zlib is unavaliable
37 StatusOutOfMemory, // there was not enough memory
38 StatusBufferTooShort, // there was not enough room in the output buffer
39 StatusInvalidArg, // invalid input parameter
40 StatusInvalidData // data was corrupted or incomplete
45 Status compress(StringRef InputBuffer,
46 OwningPtr<MemoryBuffer> &CompressedBuffer,
47 CompressionLevel Level = DefaultCompression);
49 Status uncompress(StringRef InputBuffer,
50 OwningPtr<MemoryBuffer> &UncompressedBuffer,
51 size_t UncompressedSize);
53 uint32_t crc32(StringRef Buffer);
55 } // End of namespace zlib
57 } // End of namespace llvm