Skip to content

Commit 800c0de

Browse files
committed
feefrac: rework comments around Mul/MulFallback
1 parent fcfe008 commit 800c0de

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/util/feefrac.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,21 @@
3737
*/
3838
struct FeeFrac
3939
{
40-
/** Fallback version for Mul (see below).
41-
*
42-
* Separate to permit testing on platforms where it isn't actually needed.
43-
*/
40+
/** Helper function for 32*64 signed multiplication, returning an unspecified but totally
41+
* ordered type. This is a fallback version, separate so it can be tested on platforms where
42+
* it isn't actually needed. */
4443
static inline std::pair<int64_t, uint32_t> MulFallback(int64_t a, int32_t b) noexcept
4544
{
46-
// Otherwise, emulate 96-bit multiplication using two 64-bit multiplies.
4745
int64_t low = int64_t{static_cast<uint32_t>(a)} * b;
4846
int64_t high = (a >> 32) * b;
4947
return {high + (low >> 32), static_cast<uint32_t>(low)};
5048
}
5149

52-
// Compute a * b, returning an unspecified but totally ordered type.
5350
#ifdef __SIZEOF_INT128__
51+
/** Helper function for 32*64 signed multiplication, returning an unspecified but totally
52+
* ordered type. This is a version relying on __int128. */
5453
static inline __int128 Mul(int64_t a, int32_t b) noexcept
5554
{
56-
// If __int128 is available, use 128-bit wide multiply.
5755
return __int128{a} * b;
5856
}
5957
#else

0 commit comments

Comments
 (0)