From ee42d87121d32f15c1aabb9e3eb4569a2937cced Mon Sep 17 00:00:00 2001 From: Paul-Henry Kajfasz Date: Thu, 22 Aug 2024 16:14:19 +0100 Subject: [PATCH] Replace i. by 1. --- src/hash/rescue/arch/x86_64_avx2.rs | 43 ++++++++++++++++------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/hash/rescue/arch/x86_64_avx2.rs b/src/hash/rescue/arch/x86_64_avx2.rs index 5d217e6..cf23a67 100644 --- a/src/hash/rescue/arch/x86_64_avx2.rs +++ b/src/hash/rescue/arch/x86_64_avx2.rs @@ -5,36 +5,41 @@ use core::arch::x86_64::*; // Preliminary notes: // 1. AVX does not support addition with carry but 128-bit (2-word) addition can be easily emulated. -// The method recognizes that for a + b overflowed iff (a + b) < a: i. res_lo = a_lo + b_lo ii. -// carry_mask = res_lo < a_lo iii. res_hi = a_hi + b_hi - carry_mask +// The method recognizes that for a + b overflowed iff (a + b) < a: +// 1. res_lo = a_lo + b_lo +// 2. carry_mask = res_lo < a_lo +// 3. res_hi = a_hi + b_hi - carry_mask // -// Notice that carry_mask is subtracted, not added. -// -// This is because AVX comparison instructions return -1 (all bits 1) for true and 0 for false. +// Notice that carry_mask is subtracted, not added. This is because AVX comparison instructions +// return -1 (all bits 1) for true and 0 for false. // // 2. AVX does not have unsigned 64-bit comparisons. Those can be emulated with signed comparisons // by recognizing that a