This commit is contained in:
nub31
2025-06-26 11:58:45 +02:00
parent f40bbe4b0b
commit 7cd1ea1dce
49 changed files with 5746 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
.intel_syntax noprefix
.text
.globl nub_string_length
# func nub_string_length(string: string): u64
nub_string_length:
mov rsi, [rdi] # Length of string in bytes
add rdi, 8 # Start of bytes
xor rax, rax # Character count
xor rdx, rdx # Current byte position
test rsi, rsi
jz _done
_count_loop:
cmp rdx, rsi
jge _done
mov dl, [rdi + rdx]
and dl, 0b11000000
cmp dl, 0b10000000
je _skip_byte
inc rax
_skip_byte:
inc rdx
jmp _count_loop
_done:
ret