Closed Alexhuszagh closed 3 years ago
This generates more efficient assembly, and also makes justifying trim easier to rationalize from a cursory glance at the code.
trim
Original
example::Decimal::try_add_digit: mov rax, qword ptr [rdi] cmp rax, 767 ja .LBB0_2 mov byte ptr [rdi + rax + 14], sil mov rax, qword ptr [rdi] .LBB0_2: add rax, 1 mov qword ptr [rdi], rax ret
New
example::Decimal::try_add_digit: mov rax, qword ptr [rdi] cmp rax, 767 ja .LBB0_2 mov byte ptr [rdi + rax + 14], sil add qword ptr [rdi], 1 .LBB0_2: ret
This generates more efficient assembly, and also makes justifying
trim
easier to rationalize from a cursory glance at the code.Original
New