react-native-windows 0.68.10 → 0.68.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,336 @@
1
+ /*
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #include <folly/lang/ToAscii.h>
18
+
19
+ namespace folly {
20
+
21
+ namespace detail {
22
+
23
+ template <uint64_t Base, typename Alphabet>
24
+ struct to_ascii_array {
25
+ using data_type_ = c_array<uint8_t, Base>;
26
+ static constexpr data_type_ data_() {
27
+ data_type_ result{};
28
+ Alphabet alpha;
29
+ for (size_t i = 0; i < Base; ++i) {
30
+ result.data[i] = alpha(static_cast<uint8_t>(i));
31
+ }
32
+ return result;
33
+ }
34
+ // @lint-ignore CLANGTIDY
35
+ static data_type_ const data;
36
+ constexpr char operator()(uint8_t index) const { // also an alphabet
37
+ return data.data[index];
38
+ }
39
+ };
40
+
41
+ template <uint64_t Base, typename Alphabet>
42
+ alignas(kIsMobile ? sizeof(size_t) : hardware_constructive_interference_size)
43
+ typename to_ascii_array<Base, Alphabet>::data_type_ const
44
+ to_ascii_array<Base, Alphabet>::data =
45
+ to_ascii_array<Base, Alphabet>::data_();
46
+
47
+ extern template to_ascii_array<8, to_ascii_alphabet_lower>::data_type_ const
48
+ to_ascii_array<8, to_ascii_alphabet_lower>::data;
49
+ extern template to_ascii_array<10, to_ascii_alphabet_lower>::data_type_ const
50
+ to_ascii_array<10, to_ascii_alphabet_lower>::data;
51
+ extern template to_ascii_array<16, to_ascii_alphabet_lower>::data_type_ const
52
+ to_ascii_array<16, to_ascii_alphabet_lower>::data;
53
+ extern template to_ascii_array<8, to_ascii_alphabet_upper>::data_type_ const
54
+ to_ascii_array<8, to_ascii_alphabet_upper>::data;
55
+ extern template to_ascii_array<10, to_ascii_alphabet_upper>::data_type_ const
56
+ to_ascii_array<10, to_ascii_alphabet_upper>::data;
57
+ extern template to_ascii_array<16, to_ascii_alphabet_upper>::data_type_ const
58
+ to_ascii_array<16, to_ascii_alphabet_upper>::data;
59
+
60
+ template <uint64_t Base, typename Alphabet>
61
+ struct to_ascii_table {
62
+ using data_type_ = c_array<uint16_t, Base * Base>;
63
+ static constexpr data_type_ data_() {
64
+ data_type_ result{};
65
+ Alphabet alpha;
66
+ for (size_t i = 0; i < Base * Base; ++i) {
67
+ result.data[i] = //
68
+ (alpha(uint8_t(i / Base)) << (kIsLittleEndian ? 0 : 8)) |
69
+ (alpha(uint8_t(i % Base)) << (kIsLittleEndian ? 8 : 0));
70
+ }
71
+ return result;
72
+ }
73
+ // @lint-ignore CLANGTIDY
74
+ static data_type_ const data;
75
+ };
76
+ template <uint64_t Base, typename Alphabet>
77
+ alignas(hardware_constructive_interference_size)
78
+ typename to_ascii_table<Base, Alphabet>::data_type_ const
79
+ to_ascii_table<Base, Alphabet>::data =
80
+ to_ascii_table<Base, Alphabet>::data_();
81
+
82
+ extern template to_ascii_table<8, to_ascii_alphabet_lower>::data_type_ const
83
+ to_ascii_table<8, to_ascii_alphabet_lower>::data;
84
+ extern template to_ascii_table<10, to_ascii_alphabet_lower>::data_type_ const
85
+ to_ascii_table<10, to_ascii_alphabet_lower>::data;
86
+ extern template to_ascii_table<16, to_ascii_alphabet_lower>::data_type_ const
87
+ to_ascii_table<16, to_ascii_alphabet_lower>::data;
88
+ extern template to_ascii_table<8, to_ascii_alphabet_upper>::data_type_ const
89
+ to_ascii_table<8, to_ascii_alphabet_upper>::data;
90
+ extern template to_ascii_table<10, to_ascii_alphabet_upper>::data_type_ const
91
+ to_ascii_table<10, to_ascii_alphabet_upper>::data;
92
+ extern template to_ascii_table<16, to_ascii_alphabet_upper>::data_type_ const
93
+ to_ascii_table<16, to_ascii_alphabet_upper>::data;
94
+
95
+ template <uint64_t Base, typename I>
96
+ struct to_ascii_powers {
97
+ static constexpr size_t size_(I v) {
98
+ return 1 + (v < Base ? 0 : size_(v / Base));
99
+ }
100
+ static constexpr size_t const size = size_(~I(0));
101
+ using data_type_ = c_array<I, size>;
102
+ static constexpr data_type_ data_() {
103
+ data_type_ result{};
104
+ for (size_t i = 0; i < size; ++i) {
105
+ result.data[i] = constexpr_pow(Base, i);
106
+ }
107
+ return result;
108
+ }
109
+ // @lint-ignore CLANGTIDY
110
+ static data_type_ const data;
111
+ };
112
+ template <uint64_t Base, typename I>
113
+ constexpr size_t const to_ascii_powers<Base, I>::size;
114
+ template <uint64_t Base, typename I>
115
+ alignas(hardware_constructive_interference_size)
116
+ typename to_ascii_powers<Base, I>::data_type_ const
117
+ to_ascii_powers<Base, I>::data = to_ascii_powers<Base, I>::data_();
118
+
119
+ extern template to_ascii_powers<8, uint64_t>::data_type_ const
120
+ to_ascii_powers<8, uint64_t>::data;
121
+ extern template to_ascii_powers<10, uint64_t>::data_type_ const
122
+ to_ascii_powers<10, uint64_t>::data;
123
+ extern template to_ascii_powers<16, uint64_t>::data_type_ const
124
+ to_ascii_powers<16, uint64_t>::data;
125
+
126
+ template <uint64_t Base>
127
+ FOLLY_ALWAYS_INLINE size_t to_ascii_size_imuls(uint64_t v) {
128
+ using powers = to_ascii_powers<Base, uint64_t>;
129
+ uint64_t p = 1;
130
+ for (size_t i = 0u; i < powers::size; ++i, p *= Base) {
131
+ if (FOLLY_UNLIKELY(v < p)) {
132
+ return i + size_t(i == 0);
133
+ }
134
+ }
135
+ return powers::size;
136
+ }
137
+
138
+ template <uint64_t Base>
139
+ FOLLY_ALWAYS_INLINE size_t to_ascii_size_idivs(uint64_t v) {
140
+ size_t i = 1;
141
+ while (v >= Base) {
142
+ i += 1;
143
+ v /= Base;
144
+ }
145
+ return i;
146
+ }
147
+
148
+ template <uint64_t Base>
149
+ FOLLY_ALWAYS_INLINE size_t to_ascii_size_array(uint64_t v) {
150
+ using powers = to_ascii_powers<Base, uint64_t>;
151
+ for (size_t i = 0u; i < powers::size; ++i) {
152
+ if (FOLLY_LIKELY(v < powers::data.data[i])) {
153
+ return i + size_t(i == 0);
154
+ }
155
+ }
156
+ return powers::size;
157
+ }
158
+
159
+ // For some architectures, we can get a little help from clzll, the "count
160
+ // leading zeros" builtin, which is backed by a single performant instruction.
161
+ //
162
+ // Note that the compiler implements __builtin_clzll on all architectures, but
163
+ // only emits a single clzll instruction when the architecture has one.
164
+ //
165
+ // This implementation may be faster than the basic ones in the general case
166
+ // because the time taken to compute this one is constant for non-zero v,
167
+ // whereas the basic ones take time proportional to log<2>(v). Whether this one
168
+ // is actually faster depends on the emitted code for this implementation and
169
+ // on whether the loops in the basic implementations are unrolled.
170
+ template <uint64_t Base>
171
+ FOLLY_ALWAYS_INLINE size_t to_ascii_size_clzll(uint64_t v) {
172
+ using powers = to_ascii_powers<Base, uint64_t>;
173
+
174
+ // clzll is undefined for 0; must special case this
175
+ if (FOLLY_UNLIKELY(!v)) {
176
+ return 1;
177
+ }
178
+
179
+ // log2 is approx log<2>(v)
180
+ size_t const vlog2 = 64 - static_cast<size_t>(__builtin_clzll(v));
181
+
182
+ // work around msvc warning C4127 (conditional expression is constant)
183
+ bool false_ = false;
184
+
185
+ // handle directly when Base is power-of-two
186
+ if (false_ || !(Base & (Base - 1))) {
187
+ constexpr auto const blog2 = constexpr_log2(Base);
188
+ return vlog2 / blog2 + size_t(vlog2 % blog2 != 0);
189
+ }
190
+
191
+ // blog2r is approx 1 / log<2>(Base), used in log change-of-base just below
192
+ constexpr auto const blog2r = 8. / constexpr_log2(constexpr_pow(Base, 8));
193
+
194
+ // vlogb is approx log<Base>(v) = log<2>(v) / log<2>(Base)
195
+ auto const vlogb = vlog2 * size_t(blog2r * 256) / 256;
196
+
197
+ // return vlogb, adjusted if necessary
198
+ return vlogb + size_t(vlogb < powers::size && v >= powers::data.data[vlogb]);
199
+ }
200
+
201
+ template <uint64_t Base>
202
+ FOLLY_ALWAYS_INLINE size_t to_ascii_size_route(uint64_t v) {
203
+ return kIsArchAmd64 && !(Base & (Base - 1)) //
204
+ ? to_ascii_size_clzll<Base>(v)
205
+ : to_ascii_size_array<Base>(v);
206
+ }
207
+
208
+ // The straightforward implementation, assuming the size known in advance.
209
+ //
210
+ // The straightforward implementation without the size known in advance would
211
+ // entail emitting the bytes backward and then reversing them at the end, once
212
+ // the size is known.
213
+ template <uint64_t Base, typename Alphabet>
214
+ FOLLY_ALWAYS_INLINE void to_ascii_with_basic(
215
+ char* out, size_t size, uint64_t v) {
216
+ Alphabet const xlate;
217
+ for (auto pos = size - 1; pos; --pos) {
218
+ // keep /, % together so a peephole optimization computes them together
219
+ auto const q = v / Base;
220
+ auto const r = v % Base;
221
+ out[pos] = xlate(uint8_t(r));
222
+ v = q;
223
+ }
224
+ out[0] = xlate(uint8_t(v));
225
+ }
226
+
227
+ // A variant of the straightforward implementation, but using a lookup table.
228
+ template <uint64_t Base, typename Alphabet>
229
+ FOLLY_ALWAYS_INLINE void to_ascii_with_array(
230
+ char* out, size_t size, uint64_t v) {
231
+ using array = to_ascii_array<Base, Alphabet>; // also an alphabet
232
+ to_ascii_with_basic<Base, array>(out, size, v);
233
+ }
234
+
235
+ // A trickier implementation which performs half as many divides as the other,
236
+ // more straightforward, implementation. On modern hardware, the divides are
237
+ // the bottleneck (even when the compiler emits a complicated sequence of add,
238
+ // sub, and mul instructions with special constants to simulate a divide by a
239
+ // fixed denominator).
240
+ //
241
+ // The downside of this implementation is that the emitted code is larger,
242
+ // especially when the divide is simulated, which affects inlining decisions.
243
+ template <uint64_t Base, typename Alphabet>
244
+ FOLLY_ALWAYS_INLINE void to_ascii_with_table(
245
+ char* out, size_t size, uint64_t v) {
246
+ using table = to_ascii_table<Base, Alphabet>;
247
+ auto pos = size - 2;
248
+ while (FOLLY_UNLIKELY(v >= Base * Base)) {
249
+ // keep /, % together so a peephole optimization computes them together
250
+ auto const q = v / (Base * Base);
251
+ auto const r = v % (Base * Base);
252
+ auto const val = table::data.data[size_t(r)];
253
+ std::memcpy(out + pos, &val, 2);
254
+ pos -= 2;
255
+ v = q;
256
+ }
257
+ auto const val = table::data.data[size_t(v)];
258
+ if (FOLLY_UNLIKELY(size % 2 == 0)) {
259
+ std::memcpy(out, &val, 2);
260
+ } else {
261
+ *out = val >> (kIsLittleEndian ? 8 : 0);
262
+ }
263
+ }
264
+ template <uint64_t Base, typename Alphabet>
265
+ FOLLY_ALWAYS_INLINE size_t to_ascii_with_table(char* out, uint64_t v) {
266
+ auto const size = to_ascii_size_route<Base>(v);
267
+ to_ascii_with_table<Base, Alphabet>(out, size, v);
268
+ return size;
269
+ }
270
+
271
+ template <uint64_t Base, typename Alphabet>
272
+ FOLLY_ALWAYS_INLINE size_t
273
+ to_ascii_with_route(char* outb, char const* oute, uint64_t v) {
274
+ auto const size = to_ascii_size_route<Base>(v);
275
+ if (FOLLY_UNLIKELY(oute < outb || size_t(oute - outb) < size)) {
276
+ return 0;
277
+ }
278
+ kIsMobile //
279
+ ? to_ascii_with_array<Base, Alphabet>(outb, size, v)
280
+ : to_ascii_with_table<Base, Alphabet>(outb, size, v);
281
+ return size;
282
+ }
283
+ template <uint64_t Base, typename Alphabet, size_t N>
284
+ FOLLY_ALWAYS_INLINE size_t to_ascii_with_route(char (&out)[N], uint64_t v) {
285
+ static_assert(N >= to_ascii_powers<Base, decltype(v)>::size, "out too small");
286
+ return to_ascii_with_table<Base, Alphabet>(out, v);
287
+ }
288
+
289
+ size_t to_ascii_size_route<10>(uint64_t v);
290
+
291
+
292
+ template to_ascii_array<8, to_ascii_alphabet_lower>::data_type_ const
293
+ to_ascii_array<8, to_ascii_alphabet_lower>::data;
294
+ template to_ascii_array<10, to_ascii_alphabet_lower>::data_type_ const
295
+ to_ascii_array<10, to_ascii_alphabet_lower>::data;
296
+ template to_ascii_array<16, to_ascii_alphabet_lower>::data_type_ const
297
+ to_ascii_array<16, to_ascii_alphabet_lower>::data;
298
+ template to_ascii_array<8, to_ascii_alphabet_upper>::data_type_ const
299
+ to_ascii_array<8, to_ascii_alphabet_upper>::data;
300
+ template to_ascii_array<10, to_ascii_alphabet_upper>::data_type_ const
301
+ to_ascii_array<10, to_ascii_alphabet_upper>::data;
302
+ template to_ascii_array<16, to_ascii_alphabet_upper>::data_type_ const
303
+ to_ascii_array<16, to_ascii_alphabet_upper>::data;
304
+
305
+ template to_ascii_table<8, to_ascii_alphabet_lower>::data_type_ const
306
+ to_ascii_table<8, to_ascii_alphabet_lower>::data;
307
+ template to_ascii_table<10, to_ascii_alphabet_lower>::data_type_ const
308
+ to_ascii_table<10, to_ascii_alphabet_lower>::data;
309
+ template to_ascii_table<16, to_ascii_alphabet_lower>::data_type_ const
310
+ to_ascii_table<16, to_ascii_alphabet_lower>::data;
311
+ template to_ascii_table<8, to_ascii_alphabet_upper>::data_type_ const
312
+ to_ascii_table<8, to_ascii_alphabet_upper>::data;
313
+ template to_ascii_table<10, to_ascii_alphabet_upper>::data_type_ const
314
+ to_ascii_table<10, to_ascii_alphabet_upper>::data;
315
+ template to_ascii_table<16, to_ascii_alphabet_upper>::data_type_ const
316
+ to_ascii_table<16, to_ascii_alphabet_upper>::data;
317
+
318
+ template to_ascii_powers<8, uint64_t>::data_type_ const
319
+ to_ascii_powers<8, uint64_t>::data;
320
+ template to_ascii_powers<10, uint64_t>::data_type_ const
321
+ to_ascii_powers<10, uint64_t>::data;
322
+ template to_ascii_powers<16, uint64_t>::data_type_ const
323
+ to_ascii_powers<16, uint64_t>::data;
324
+
325
+ // [Windows] Code to ensure functions exist to export
326
+ void forExports() {
327
+ auto b = to_ascii_size_route<10>(0);
328
+ char cc[20];
329
+ auto a = to_ascii_with_route<10, to_ascii_alphabet<false>, 20>(cc, 0);
330
+ char d, e;
331
+ auto r = to_ascii_with_route<10, to_ascii_alphabet<false>>(&d, &e, static_cast<uint64_t>(0));
332
+ }
333
+
334
+ } // namespace detail
335
+
336
+ } // namespace folly
@@ -0,0 +1,182 @@
1
+ /*
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #pragma once
18
+
19
+ #include <cstring>
20
+
21
+ #include <folly/ConstexprMath.h>
22
+ #include <folly/Likely.h>
23
+ #include <folly/Portability.h>
24
+ #include <folly/Utility.h>
25
+ #include <folly/lang/Align.h>
26
+ #include <folly/lang/CArray.h>
27
+ #include <folly/portability/Builtins.h>
28
+
29
+ namespace folly {
30
+
31
+ // to_ascii_alphabet
32
+ //
33
+ // Used implicity by to_ascii_lower and to_ascii_upper below.
34
+ //
35
+ // This alphabet translates digits to 0-9,a-z or 0-9,A-Z. The largest supported
36
+ // base is 36; operator() presumes an argument less than that.
37
+ //
38
+ // Alternative alphabets may be used with to_ascii_with provided they match
39
+ // the constructibility/destructibility and the interface of this one.
40
+ template <bool Upper>
41
+ struct to_ascii_alphabet {
42
+ // operator()
43
+ //
44
+ // Translates a single digit to 0-9,a-z or 0-9,A-Z.
45
+ //
46
+ // async-signal-safe
47
+ constexpr char operator()(uint8_t b) const {
48
+ return b < 10 ? '0' + b : (Upper ? 'A' : 'a') + (b - 10);
49
+ }
50
+ };
51
+ using to_ascii_alphabet_lower = to_ascii_alphabet<false>;
52
+ using to_ascii_alphabet_upper = to_ascii_alphabet<true>;
53
+
54
+ // to_ascii_size_max
55
+ // [Windows] - Replaced logic that required data with values just for the
56
+ // bases required to compile.
57
+ //
58
+ // The maximum size buffer that might be required to hold the ascii-encoded
59
+ // representation of any value of unsigned type I in base Base.
60
+ //
61
+ // In base 10, u64 requires at most 20 bytes, u32 at most 10, u16 at most 5,
62
+ // and u8 at most 3.
63
+ /*
64
+ template <uint64_t Base, typename I>
65
+ FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max =
66
+ detail::to_ascii_powers<Base, I>::size;
67
+ */
68
+ // to_ascii_size_max_decimal
69
+ //
70
+ // An alias to to_ascii_size_max<10>.
71
+ template <typename I>
72
+ FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max_decimal;
73
+
74
+ template <>
75
+ FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max_decimal<uint16_t> = 5;
76
+ template <>
77
+ FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max_decimal<uint32_t> = 10;
78
+ template <>
79
+ FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max_decimal<uint64_t> = 20;
80
+
81
+
82
+ namespace detail {
83
+
84
+ // [Windows] Moved most of the detail namespace into the cpp file to avoid having data fields on the dll boundary
85
+
86
+ template <uint64_t Base>
87
+ FOLLY_ALWAYS_INLINE size_t to_ascii_size_route(uint64_t v);
88
+
89
+
90
+ template <uint64_t Base, typename Alphabet>
91
+ FOLLY_ALWAYS_INLINE size_t
92
+ to_ascii_with_route(char* outb, char const* oute, uint64_t v);
93
+
94
+ template <uint64_t Base, typename Alphabet, size_t N>
95
+ FOLLY_ALWAYS_INLINE size_t to_ascii_with_route(char (&out)[N], uint64_t v);
96
+
97
+ }
98
+
99
+ // to_ascii_size
100
+ //
101
+ // Returns the number of digits in the base Base representation of a uint64_t.
102
+ // Useful for preallocating buffers, etc.
103
+ //
104
+ // async-signal-safe
105
+ template <uint64_t Base>
106
+ size_t to_ascii_size(uint64_t v) {
107
+ return detail::to_ascii_size_route<Base>(v);
108
+ }
109
+
110
+ // to_ascii_size_decimal
111
+ //
112
+ // An alias to to_ascii_size<10>.
113
+ //
114
+ // async-signal-safe
115
+ inline size_t to_ascii_size_decimal(uint64_t v) {
116
+ return to_ascii_size<10>(v);
117
+ }
118
+
119
+ // to_ascii_with
120
+ //
121
+ // Copies the digits of v, in base Base, translated with Alphabet, into buffer
122
+ // and returns the number of bytes written.
123
+ //
124
+ // Does *not* append a null terminator. It is the caller's responsibility to
125
+ // append a null terminator if one is required.
126
+ //
127
+ // Assumes buffer points to at least to_ascii_size<Base>(v) bytes of writable
128
+ // memory. It is the caller's responsibility to provide a writable buffer with
129
+ // the required min size.
130
+ //
131
+ // async-signal-safe
132
+ template <uint64_t Base, typename Alphabet>
133
+ size_t to_ascii_with(char* outb, char const* oute, uint64_t v) {
134
+ return detail::to_ascii_with_route<Base, Alphabet>(outb, oute, v);
135
+ }
136
+ template <uint64_t Base, typename Alphabet, size_t N>
137
+ size_t to_ascii_with(char (&out)[N], uint64_t v) {
138
+ return detail::to_ascii_with_route<Base, Alphabet>(out, v);
139
+ }
140
+
141
+ // to_ascii_lower
142
+ //
143
+ // Composes to_ascii_with with to_ascii_alphabet_lower.
144
+ //
145
+ // async-signal-safe
146
+ template <uint64_t Base>
147
+ size_t to_ascii_lower(char* outb, char const* oute, uint64_t v) {
148
+ return to_ascii_with<Base, to_ascii_alphabet_lower>(outb, oute, v);
149
+ }
150
+ template <uint64_t Base, size_t N>
151
+ size_t to_ascii_lower(char (&out)[N], uint64_t v) {
152
+ return to_ascii_with<Base, to_ascii_alphabet_lower>(out, v);
153
+ }
154
+
155
+ // to_ascii_upper
156
+ //
157
+ // Composes to_ascii_with with to_ascii_alphabet_upper.
158
+ //
159
+ // async-signal-safe
160
+ template <uint64_t Base>
161
+ size_t to_ascii_upper(char* outb, char const* oute, uint64_t v) {
162
+ return to_ascii_with<Base, to_ascii_alphabet_upper>(outb, oute, v);
163
+ }
164
+ template <uint64_t Base, size_t N>
165
+ size_t to_ascii_upper(char (&out)[N], uint64_t v) {
166
+ return to_ascii_with<Base, to_ascii_alphabet_upper>(out, v);
167
+ }
168
+
169
+ // to_ascii_decimal
170
+ //
171
+ // An alias to to_ascii<10, false>.
172
+ //
173
+ // async-signals-afe
174
+ inline size_t to_ascii_decimal(char* outb, char const* oute, uint64_t v) {
175
+ return to_ascii_lower<10>(outb, oute, v);
176
+ }
177
+ template <size_t N>
178
+ inline size_t to_ascii_decimal(char (&out)[N], uint64_t v) {
179
+ return to_ascii_lower<10>(out, v);
180
+ }
181
+
182
+ } // namespace folly
@@ -117,17 +117,21 @@ struct BrushCache {
117
117
  return RegisterBrush(resourceName, brush);
118
118
  }
119
119
 
120
- winrt::IInspectable resource{winrt::Application::Current().Resources().Lookup(winrt::box_value(resourceName))};
121
-
122
- if (auto brush = resource.try_as<xaml::Media::Brush>()) {
123
- return RegisterBrush(resourceName, brush);
124
- } else if (auto color = resource.try_as<winrt::Windows::UI::Color>()) {
125
- auto brush = xaml::Media::SolidColorBrush(color.value());
126
- return RegisterBrush(resourceName, brush);
120
+ const auto appResources{winrt::Application::Current().Resources()};
121
+ const auto boxedResourceName{winrt::box_value(resourceName)};
122
+ if (appResources.HasKey(boxedResourceName)) {
123
+ winrt::IInspectable resource{appResources.Lookup(boxedResourceName)};
124
+
125
+ if (auto brush = resource.try_as<xaml::Media::Brush>()) {
126
+ return RegisterBrush(resourceName, brush);
127
+ } else if (auto color = resource.try_as<winrt::Windows::UI::Color>()) {
128
+ auto brush = xaml::Media::SolidColorBrush(color.value());
129
+ return RegisterBrush(resourceName, brush);
130
+ }
127
131
  }
128
132
 
129
133
  assert(false && "Resource is not a Color or Brush");
130
- return nullptr;
134
+ return xaml::Media::SolidColorBrush(winrt::Colors::Transparent());
131
135
  }
132
136
 
133
137
  xaml::Media::Brush RegisterBrush(winrt::hstring resourceName, const xaml::Media::Brush &brush) {
@@ -143,7 +143,7 @@ bool ImageViewManager::UpdateProperty(
143
143
  } else if (propertyName == "tintColor") {
144
144
  const auto isValidColorValue = IsValidColorValue(propertyValue);
145
145
  if (isValidColorValue || propertyValue.IsNull()) {
146
- const auto color = isValidColorValue ? ColorFrom(propertyValue) : winrt::Colors::Transparent();
146
+ const auto color = isValidColorValue ? SolidColorBrushFrom(propertyValue).Color() : winrt::Colors::Transparent();
147
147
  reactImage->TintColor(color);
148
148
  }
149
149
  // Override default accessibility behavior
@@ -10,10 +10,10 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.68.10</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.68.13</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>68</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>10</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>13</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
18
  </PropertyGroup>
19
19
  </Project>
@@ -54,6 +54,13 @@ Get-ChildItem -Path $FollyRoot -Name -Recurse -Include $patterns | ForEach-Objec
54
54
  -Force
55
55
  }
56
56
 
57
+ # Folly overrides
58
+ Get-ChildItem -Path $ReactWindowsRoot\Folly\TEMP_UntilFollyUpdate -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
59
+ -Path $ReactWindowsRoot\Folly\TEMP_UntilFollyUpdate\$_ `
60
+ -Destination (New-Item -ItemType Directory $TargetRoot\inc\folly\$(Split-Path $_) -Force) `
61
+ -Force
62
+ }
63
+
57
64
  # stubs headers
58
65
  Get-ChildItem -Path $ReactWindowsRoot\stubs -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item `
59
66
  -Path $ReactWindowsRoot\stubs\$_ `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.68.10",
3
+ "version": "0.68.13",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",