Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
dart-lang
sdk
runtime
vm
unibrow-inl.h
Go to the documentation of this file.
1
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4
5
#ifndef RUNTIME_VM_UNIBROW_INL_H_
6
#define RUNTIME_VM_UNIBROW_INL_H_
7
8
#include "
vm/unibrow.h
"
9
10
#include "
platform/assert.h
"
11
12
namespace
unibrow
{
13
14
template
<
class
T,
int
ptr_t s>
15
intptr_t
Mapping<T, s>::get
(int32_t c, int32_t n, int32_t*
result
) {
16
CacheEntry entry = entries_[c &
kMask
];
17
if
(entry.code_point_ == c) {
18
if
(entry.offset_ == 0) {
19
return
0;
20
}
else
{
21
result
[0] = c + entry.offset_;
22
return
1;
23
}
24
}
else
{
25
return
CalculateValue(c, n,
result
);
26
}
27
}
28
29
template
<
class
T,
int
ptr_t s>
30
intptr_t
Mapping<T, s>::CalculateValue
(int32_t c, int32_t n, int32_t*
result
) {
31
bool
allow_caching =
true
;
32
intptr_t
length
= T::Convert(c, n,
result
, &allow_caching);
33
if
(allow_caching) {
34
if
(
length
== 1) {
35
entries_[c &
kMask
] = CacheEntry(c,
result
[0] - c);
36
return
1;
37
}
else
{
38
entries_[c &
kMask
] = CacheEntry(c, 0);
39
return
0;
40
}
41
}
else
{
42
return
length
;
43
}
44
}
45
46
}
// namespace unibrow
47
48
#endif
// RUNTIME_VM_UNIBROW_INL_H_
kMask
static constexpr uint64_t kMask
Definition
DrawPass.cpp:53
assert.h
unibrow::Mapping
Definition
unibrow.h:24
unibrow::Mapping::get
intptr_t get(int32_t c, int32_t n, int32_t *result)
Definition
unibrow-inl.h:15
result
GAsyncResult * result
Definition
fl_text_input_plugin.cc:106
length
size_t length
Definition
key_event_handler.cc:41
unibrow
Definition
unibrow-inl.h:12
unibrow.h
Generated on Fri Apr 26 2024 06:15:20 for Flutter Engine by
1.9.8