Skip to content

Commit 3aa25cd

Browse files
committed
Fix validate_unicode_scalar_sequence build errors on aarch64
1 parent c1de3f7 commit 3aa25cd

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

godot-core/src/builtin/string_chars.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,23 @@ pub fn validate_unicode_scalar_sequence(seq: &[u32]) -> Option<&[char]> {
4747
ptr = ptr_next;
4848
}
4949

50-
// still untested but it should work
5150
#[cfg(target_arch = "aarch64")]
5251
loop {
5352
let ptr_next = ptr.add(4);
5453
if ptr_next > ptr_end {
5554
break;
5655
}
5756

58-
let block = uint32x4_t::load_unaligned(ptr as *const u32);
57+
let block = vld1q_u32(ptr as *const u32);
5958

6059
// check if has any character bigger than `char::MAX`
61-
if (vqmovltq_u32(block, vdupq_n_u32(char::MAX as u32))).any() {
60+
if vmaxvq_u32(block) >= char::MAX as u32 {
6261
return None;
6362
}
6463

6564
// check if has any high-surrogate and low-surrogate code points
66-
if !vandq_u32(
67-
vcgtq_u32(block, vdupq_n_u32(0xD7FF)),
68-
vcltq_u32(block, vdupq_n_u32(0xE000)),
69-
)
70-
.is_zero()
71-
{
65+
// This is in the range `0xD800..0xE000`.
66+
if vminvq_u32(vsubq_u32(block, vdupq_n_u32(0xD800))) < (0xE000 - 0xD800) {
7267
return None;
7368
}
7469

0 commit comments

Comments
 (0)