LLVM  8.0.1
Compression.h
Go to the documentation of this file.
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 
26 static constexpr int NoCompression = 0;
27 static constexpr int BestSpeedCompression = 1;
28 static constexpr int DefaultCompression = 6;
29 static constexpr int BestSizeCompression = 9;
30 
31 bool isAvailable();
32 
33 Error compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
34  int Level = DefaultCompression);
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
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Error compress(StringRef InputBuffer, SmallVectorImpl< char > &CompressedBuffer, int Level=DefaultCompression)
Definition: Compression.cpp:50
static constexpr int BestSpeedCompression
Definition: Compression.h:27
static constexpr int BestSizeCompression
Definition: Compression.h:29
static constexpr int DefaultCompression
Definition: Compression.h:28
bool isAvailable()
Definition: Compression.cpp:48
static constexpr int NoCompression
Definition: Compression.h:26
uint32_t crc32(StringRef Buffer)
Definition: Compression.cpp:85
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Error uncompress(StringRef InputBuffer, char *UncompressedBuffer, size_t &UncompressedSize)
Definition: Compression.cpp:64