1 /* Copyright 2013 Google Inc. All Rights Reserved.
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
7 /* Heuristics for deciding about the UTF8-ness of strings. */
9 #ifndef BROTLI_ENC_UTF8_UTIL_H_
10 #define BROTLI_ENC_UTF8_UTIL_H_
12 #include "../common/types.h"
15 #if defined(__cplusplus) || defined(c_plusplus)
19 static const double kMinUTF8Ratio
= 0.75;
21 /* Returns 1 if at least min_fraction of the bytes between pos and
22 pos + length in the (data, mask) ringbuffer is UTF8-encoded, otherwise
24 BROTLI_INTERNAL BROTLI_BOOL
BrotliIsMostlyUTF8(
25 const uint8_t* data
, const size_t pos
, const size_t mask
,
26 const size_t length
, const double min_fraction
);
28 #if defined(__cplusplus) || defined(c_plusplus)
32 #endif /* BROTLI_ENC_UTF8_UTIL_H_ */