Mulhi is an instruction that is effectively available on any 64 bits CPU that multiply that effectively does the following:
ulong mulhi(ulong a, ulong b) {
return (ucent(a) * ucent(b)) >> 64;
}
And this is how you'd implement it in say, C++, using __int128
.
This operation is absolutely capital to do hashing fast, as it allows to do a ton of shit and adds in one go. You'd ask, isn't that what the good old regular multiplication does too? and no, it isn't, because it never shift right, so high bits can never influence lowers ones.