From a79be7ece0b857e237c3e1ef1261f74b15d9d714 Mon Sep 17 00:00:00 2001 From: Mikhail Tavarez Date: Wed, 17 Apr 2024 12:46:32 -0500 Subject: [PATCH] fix unicode --- .pre-commit-config.yaml | 10 +++++----- gojo/unicode/utf8/runes.mojo | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6b280e1..310b24b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,12 +2,12 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace -- repo: local + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: local hooks: - - id: mojo-format + - id: mojo-format name: mojo-format entry: mojo format -l 120 language: system diff --git a/gojo/unicode/utf8/runes.mojo b/gojo/unicode/utf8/runes.mojo index 9d2040e..56da84b 100644 --- a/gojo/unicode/utf8/runes.mojo +++ b/gojo/unicode/utf8/runes.mojo @@ -328,7 +328,7 @@ fn rune_count_in_string(s: String) -> Int: @parameter fn count[simd_width: Int](offset: Int): - result += ((p.load[width=simd_width](offset) >> 6) != 0b10).cast[DType.uint8]().reduce_add().to_int() + result += int(((p.load[width=simd_width](offset) >> 6) != 0b10).cast[DType.uint8]().reduce_add()) vectorize[count, simd_width_u8](string_byte_length) return result @@ -344,7 +344,7 @@ fn string_iterator(s: String, func: fn (String) -> None): var bytes = len(s) var p = s._as_ptr().bitcast[DType.uint8]() while bytes > 0: - var char_length = ((p.load() >> 7 == 0).cast[DType.uint8]() * 1 + ctlz(~p.load())).to_int() + var char_length = int((p.load() >> 7 == 0).cast[DType.uint8]() * 1 + ctlz(~p.load())) var sp = DTypePointer[DType.int8].alloc(char_length + 1) memcpy(sp, p.bitcast[DType.int8](), char_length) sp[char_length] = 0