Skip to content

Commit

Permalink
fix unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty committed Apr 17, 2024
1 parent 7ca8482 commit a79be7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gojo/unicode/utf8/runes.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a79be7e

Please sign in to comment.