diff options
| author | dearblue <[email protected]> | 2019-06-22 16:32:17 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2019-06-22 22:36:58 +0900 |
| commit | bd2c93c2dfbb944f57b10b7b9c056caf852a5053 (patch) | |
| tree | 0d8f1aa2f576ac43f02cca7859c3a9aadac3ad53 /src/opcode.h | |
| parent | 7c6d6effaea6ec3cbac01cffc4f094744d53d8b9 (diff) | |
| download | mruby-bd2c93c2dfbb944f57b10b7b9c056caf852a5053.tar.gz mruby-bd2c93c2dfbb944f57b10b7b9c056caf852a5053.zip | |
Change to UTF-8 string reversing with in place
Reverses UTF-8 strings without allocated heap for working memory.
1. String before reversing:
```
"!yburmの界世"
# byte unit
[33, 121, 98, 117, 114, 109, 227, 129, 174, 231, 149, 140, 228, 184, 150]
```
2. Reverse the byte order of each character:
```
[33, 121, 98, 117, 114, 109, 174, 129, 227, 140, 149, 231, 150, 184, 228]
```
3. Reverse the whole byte order and complete:
```
[228, 184, 150, 231, 149, 140, 227, 129, 174, 109, 114, 117, 98, 121, 33]
# string
"世界のmruby!"
```
Diffstat (limited to 'src/opcode.h')
0 files changed, 0 insertions, 0 deletions
