Add usz and isz.

This commit is contained in:
Christoffer Lerno
2022-10-09 22:21:19 +02:00
committed by Christoffer Lerno
parent 348495b4c8
commit ab78663f3c
28 changed files with 319 additions and 303 deletions

View File

@@ -5,7 +5,7 @@ module std::core::string::iterator;
struct StringIterator
{
char[] utf8;
usize current;
usz current;
}
fn void StringIterator.reset(StringIterator* this)
@@ -15,10 +15,10 @@ fn void StringIterator.reset(StringIterator* this)
fn Char32! StringIterator.next(StringIterator* this)
{
usize len = this.utf8.len;
usize current = this.current;
usz len = this.utf8.len;
usz current = this.current;
if (current >= len) return IteratorResult.NO_MORE_ELEMENT!;
usize read = (len - current < 4 ? len - current : 4);
usz read = (len - current < 4 ? len - current : 4);
Char32 res = conv::utf8_to_char32(&this.utf8[current], &read)?;
this.current += read;
return res;