|
|
|
|
|
by stephencanon
1567 days ago
|
|
This is somewhat similar to how Swift represents Strings internally (https://github.com/apple/swift/blob/main/stdlib/public/core/...). Swift needs to support a few other options (it tracks UTF-8 vs UTF-16 encodings, and needs to know if a String is bridged from an Objective-C object), and it doesn't cap lengths or offsets at 32b. Those details aside, this is a very familiar approach. |
|