| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 // All the code in this file is a direct copy from dart:convert. It is | 5 // All the code in this file is a direct copy from dart:convert. It is |
| 6 // here to remove the dependency on dart:convert which will not be | 6 // here to remove the dependency on dart:convert which will not be |
| 7 // part of the library set for embedded due to its dependency on | 7 // part of the library set for embedded due to its dependency on |
| 8 // dart:async. | 8 // dart:async. |
| 9 part of dart.fletch.ffi; | 9 part of dart.dartino.ffi; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Converts [string] to its UTF-8 code units (a list of | 12 * Converts [string] to its UTF-8 code units (a list of |
| 13 * unsigned 8-bit integers). | 13 * unsigned 8-bit integers). |
| 14 * | 14 * |
| 15 * If [start] and [end] are provided, only the substring | 15 * If [start] and [end] are provided, only the substring |
| 16 * `string.substring(start, end)` is converted. | 16 * `string.substring(start, end)` is converted. |
| 17 */ | 17 */ |
| 18 List<int> _encodeUtf8(String string, [int start = 0, int end]) { | 18 List<int> _encodeUtf8(String string, [int start = 0, int end]) { |
| 19 int stringLength = string.length; | 19 int stringLength = string.length; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 const int _TAIL_SURROGATE_MIN = 0xDC00; | 165 const int _TAIL_SURROGATE_MIN = 0xDC00; |
| 166 | 166 |
| 167 bool _isLeadSurrogate(int codeUnit) => | 167 bool _isLeadSurrogate(int codeUnit) => |
| 168 (codeUnit & _SURROGATE_TAG_MASK) == _LEAD_SURROGATE_MIN; | 168 (codeUnit & _SURROGATE_TAG_MASK) == _LEAD_SURROGATE_MIN; |
| 169 bool _isTailSurrogate(int codeUnit) => | 169 bool _isTailSurrogate(int codeUnit) => |
| 170 (codeUnit & _SURROGATE_TAG_MASK) == _TAIL_SURROGATE_MIN; | 170 (codeUnit & _SURROGATE_TAG_MASK) == _TAIL_SURROGATE_MIN; |
| 171 int _combineSurrogatePair(int lead, int tail) => | 171 int _combineSurrogatePair(int lead, int tail) => |
| 172 0x10000 + ((lead & _SURROGATE_VALUE_MASK) << 10) | 172 0x10000 + ((lead & _SURROGATE_VALUE_MASK) << 10) |
| 173 | (tail & _SURROGATE_VALUE_MASK); | 173 | (tail & _SURROGATE_VALUE_MASK); |
| 174 | 174 |
| OLD | NEW |