Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkUTF.cpp File Reference
#include "src/base/SkUTF.h"
#include "include/private/base/SkTFitsIn.h"

Go to the source code of this file.

Functions

static constexpr int32_t left_shift (int32_t value, int32_t shift)
 
template<typename T >
static constexpr bool is_align2 (T x)
 
template<typename T >
static constexpr bool is_align4 (T x)
 
static constexpr bool utf16_is_high_surrogate (uint16_t c)
 
static constexpr bool utf16_is_low_surrogate (uint16_t c)
 
static int utf8_byte_type (uint8_t c)
 
static bool utf8_type_is_valid_leading_byte (int type)
 
static bool utf8_byte_is_continuation (uint8_t c)
 
template<typename T >
static SkUnichar next_fail (const T **ptr, const T *end)
 

Function Documentation

◆ is_align2()

template<typename T >
static constexpr bool is_align2 ( T  x)
staticconstexpr

Definition at line 12 of file SkUTF.cpp.

12{ return 0 == (x & 1); }
double x

◆ is_align4()

template<typename T >
static constexpr bool is_align4 ( T  x)
staticconstexpr

Definition at line 14 of file SkUTF.cpp.

14{ return 0 == (x & 3); }

◆ left_shift()

static constexpr int32_t left_shift ( int32_t  value,
int32_t  shift 
)
inlinestaticconstexpr

Definition at line 8 of file SkUTF.cpp.

8 {
9 return (int32_t) ((uint32_t) value << shift);
10}

◆ next_fail()

template<typename T >
static SkUnichar next_fail ( const T **  ptr,
const T end 
)
static

Definition at line 113 of file SkUTF.cpp.

113 {
114 *ptr = end;
115 return -1;
116}
glong glong end

◆ utf16_is_high_surrogate()

static constexpr bool utf16_is_high_surrogate ( uint16_t  c)
inlinestaticconstexpr

Definition at line 16 of file SkUTF.cpp.

16{ return (c & 0xFC00) == 0xD800; }

◆ utf16_is_low_surrogate()

static constexpr bool utf16_is_low_surrogate ( uint16_t  c)
inlinestaticconstexpr

Definition at line 18 of file SkUTF.cpp.

18{ return (c & 0xFC00) == 0xDC00; }

◆ utf8_byte_is_continuation()

static bool utf8_byte_is_continuation ( uint8_t  c)
static

Definition at line 43 of file SkUTF.cpp.

43{ return utf8_byte_type(c) == 0; }
static int utf8_byte_type(uint8_t c)
Definition SkUTF.cpp:28

◆ utf8_byte_type()

static int utf8_byte_type ( uint8_t  c)
static
Returns
-1 iff invalid UTF8 byte, 0 iff UTF8 continuation byte, 1 iff ASCII byte, 2 iff leading byte of 2-byte sequence, 3 iff leading byte of 3-byte sequence, and 4 iff leading byte of 4-byte sequence. I.e.: if return value > 0, then gives length of sequence.

Definition at line 28 of file SkUTF.cpp.

28 {
29 if (c < 0x80) {
30 return 1;
31 } else if (c < 0xC0) {
32 return 0;
33 } else if (c >= 0xF5 || (c & 0xFE) == 0xC0) { // "octet values c0, c1, f5 to ff never appear"
34 return -1;
35 } else {
36 int value = (((0xe5 << 24) >> ((unsigned)c >> 4 << 1)) & 3) + 1;
37 // assert(value >= 2 && value <=4);
38 return value;
39 }
40}
uint8_t value

◆ utf8_type_is_valid_leading_byte()

static bool utf8_type_is_valid_leading_byte ( int  type)
static

Definition at line 41 of file SkUTF.cpp.

41{ return type > 0; }