File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 37
37
*/
38
38
struct FeeFrac
39
39
{
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. */
44
43
static inline std::pair<int64_t , uint32_t > MulFallback (int64_t a, int32_t b) noexcept
45
44
{
46
- // Otherwise, emulate 96-bit multiplication using two 64-bit multiplies.
47
45
int64_t low = int64_t {static_cast <uint32_t >(a)} * b;
48
46
int64_t high = (a >> 32 ) * b;
49
47
return {high + (low >> 32 ), static_cast <uint32_t >(low)};
50
48
}
51
49
52
- // Compute a * b, returning an unspecified but totally ordered type.
53
50
#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. */
54
53
static inline __int128 Mul (int64_t a, int32_t b) noexcept
55
54
{
56
- // If __int128 is available, use 128-bit wide multiply.
57
55
return __int128{a} * b;
58
56
}
59
57
#else
You can’t perform that action at this time.
0 commit comments