]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/BrotliCompress/enc/utf8_util.h
BaseTools: Copy Brotli algorithm 3rd party source code for tool
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / enc / utf8_util.h
CommitLineData
11b7501a
SB
1/* Copyright 2013 Google Inc. All Rights Reserved.\r
2\r
3 Distributed under MIT license.\r
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT\r
5*/\r
6\r
7/* Heuristics for deciding about the UTF8-ness of strings. */\r
8\r
9#ifndef BROTLI_ENC_UTF8_UTIL_H_\r
10#define BROTLI_ENC_UTF8_UTIL_H_\r
11\r
12#include "../common/types.h"\r
13#include "./port.h"\r
14\r
15#if defined(__cplusplus) || defined(c_plusplus)\r
16extern "C" {\r
17#endif\r
18\r
19static const double kMinUTF8Ratio = 0.75;\r
20\r
21/* Returns 1 if at least min_fraction of the bytes between pos and\r
22 pos + length in the (data, mask) ringbuffer is UTF8-encoded, otherwise\r
23 returns 0. */\r
24BROTLI_INTERNAL BROTLI_BOOL BrotliIsMostlyUTF8(\r
25 const uint8_t* data, const size_t pos, const size_t mask,\r
26 const size_t length, const double min_fraction);\r
27\r
28#if defined(__cplusplus) || defined(c_plusplus)\r
29} /* extern "C" */\r
30#endif\r
31\r
32#endif /* BROTLI_ENC_UTF8_UTIL_H_ */\r