From 101c7d8722bdcba8b52a0c6ec69b525811edfbc2 Mon Sep 17 00:00:00 2001 From: andywiecko Date: Thu, 14 Nov 2024 17:15:21 +0100 Subject: [PATCH] refactor: slightly faster queue adaptation Refactor and optimize queue adaptation in refinement step (likely negligible impact on performance). ### Before ```asm lea eax, [rdx + 2*rdx] cmp eax, ecx sete r8b lea eax, [rdx + 2*rdx + 1] cmp eax, ecx sete al lea edx, [rdx + 2*rdx + 2] cmp edx, ecx sete cl or cl, al or cl, r8b movzx eax, cl ``` ### After ```asm movsxd rax, ecx imul rcx, rax, 1431655766 mov rax, rcx shr rax, 63 shr rcx, 32 add ecx, eax xor eax, eax cmp ecx, edx sete al ``` --- Runtime/Triangulator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runtime/Triangulator.cs b/Runtime/Triangulator.cs index 54da14a..eabf4f1 100644 --- a/Runtime/Triangulator.cs +++ b/Runtime/Triangulator.cs @@ -3531,7 +3531,7 @@ private void AdaptQueues(NativeList heQueue, NativeList tQueue) for (int i = 0; i < heQueue.Length; i++) { var he = heQueue[i]; - if (he == 3 * tId + 0 || he == 3 * tId + 1 || he == 3 * tId + 2) + if (he / 3 == tId) { heQueue[i] = -1; continue;