diff --git a/src/hash/rescue/arch/x86_64_avx2.rs b/src/hash/rescue/arch/x86_64_avx2.rs index 6626f09..5d217e6 100644 --- a/src/hash/rescue/arch/x86_64_avx2.rs +++ b/src/hash/rescue/arch/x86_64_avx2.rs @@ -5,36 +5,37 @@ 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 Notice that carry_mask is subtracted, not added. +// 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 +// +// 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