Compression.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file contains basic functions for compression/uncompression.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_SUPPORT_COMPRESSION_H
  18. #define LLVM_SUPPORT_COMPRESSION_H
  19. #include "llvm/Support/DataTypes.h"
  20. namespace llvm {
  21. template <typename T> class SmallVectorImpl;
  22. class Error;
  23. class StringRef;
  24. namespace zlib {
  25. static constexpr int NoCompression = 0;
  26. static constexpr int BestSpeedCompression = 1;
  27. static constexpr int DefaultCompression = 6;
  28. static constexpr int BestSizeCompression = 9;
  29. bool isAvailable();
  30. Error compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
  31. int Level = DefaultCompression);
  32. Error uncompress(StringRef InputBuffer, char *UncompressedBuffer,
  33. size_t &UncompressedSize);
  34. Error uncompress(StringRef InputBuffer,
  35. SmallVectorImpl<char> &UncompressedBuffer,
  36. size_t UncompressedSize);
  37. uint32_t crc32(StringRef Buffer);
  38. } // End of namespace zlib
  39. } // End of namespace llvm
  40. #endif
  41. #ifdef __GNUC__
  42. #pragma GCC diagnostic pop
  43. #endif