1- // *
1+ // *
22// *****************************************************************************
33// *
44// * Copyright (c) 2025 Deskasoft International
2727// ******************************************************************************
2828// *
2929
30+ #if NET8_0_OR_GREATER
31+ using System ;
32+ #endif
33+
34+ using System . Runtime . CompilerServices ;
35+
3036namespace HashifyNet . Algorithms . T1HA
3137{
3238 internal static class T1HAGlobals
@@ -46,5 +52,38 @@ internal static class T1HAGlobals
4652 public const ulong PRIME_4 = 0x9C06FAF4D023E3ABUL ;
4753 public const ulong PRIME_5 = 0xC060724A8424F345UL ;
4854 public const ulong PRIME_6 = 0xCB5AF53AE3AAAC31UL ;
55+
56+
57+ #if true
58+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
59+ private static ulong BigMul_ref ( ulong a , ulong b , out ulong low )
60+ {
61+ unchecked
62+ {
63+ uint al = ( uint ) a ;
64+ uint ah = ( uint ) ( a >> 32 ) ;
65+ uint bl = ( uint ) b ;
66+ uint bh = ( uint ) ( b >> 32 ) ;
67+
68+ ulong mull = ( ( ulong ) al ) * bl ;
69+ ulong t = ( ( ulong ) ah ) * bl + ( mull >> 32 ) ;
70+ ulong tl = ( ( ulong ) al ) * bh + ( uint ) t ;
71+
72+ low = tl << 32 | ( uint ) mull ;
73+
74+ return ( ( ulong ) ah ) * bh + ( t >> 32 ) + ( tl >> 32 ) ;
75+ }
76+ }
77+ #endif
78+
79+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
80+ public static void BigMul128 ( ulong x , ulong y , out ulong lo , out ulong hi )
81+ {
82+ #if NET8_0_OR_GREATER
83+ hi = Math . BigMul ( x , y , out lo ) ;
84+ #else
85+ hi = BigMul_ref ( x , y , out lo ) ;
86+ #endif
87+ }
4988 }
5089}
0 commit comments