flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Furs 02 Mar 2023, 18:35
Oops, as I suspected I messed something up because of wide chars
![]() The problem is at the top when calculating the shift: Code: and r8, -16 and edx, 15 mov ecx, 31 sub ecx, edx Code: and r8, -16 and edx, 15 mov ecx, 30 sub ecx, edx if you want, for less magic numbers, write 32 - 2 (or 32 - size_of_wchar) That's because we don't start with the last byte (bit in mask), but the second-to-last-byte, even though it's the last character. A couple more suggestions: Code: mov r10, [CurPath.Buffer] ; String buffer lea r8, [r10 + rcx - 2] ; Start addr and: Code: xor ebx, ebx mov bx, [CurPath.Length] replace with: movzx edx, word [CurPath.Length] Also, you can get rid of the "js error_exit" since it's not needed in your case. You already don't handle it in the main loop, so there's no reason to handle it only here, and it should speed things up (less branches to predict, less code, etc). This way you can simplify the tail to: Code: .found_in_tail: bsr eax, eax movzx edx, word [CurPath.Length] lea edx, [rdx + rax - (32+1)] add rdx, r10 |
|||
![]() |
|
AE 03 Mar 2023, 17:57
Furs, thank you!
|
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.