use correct uint128 functions when doing endian flipping

pull/686/head
Jeff Becker 5 years ago
parent 1fd6b5ae74
commit dc87b6dc6b
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -196,12 +196,9 @@ ntoh128(absl::uint128 i)
#if __BYTE_ORDER == __BIG_ENDIAN
return i;
#else
uint64_t *ptr = (uint64_t *)&i;
absl::uint128 ret;
uint64_t *retptr = (uint64_t *)&ret;
htobe64buf(retptr, ptr[1]);
htobe64buf(retptr + 1, ptr[0]);
return ret;
const auto loSwapped = htobe64(absl::Uint128Low64(i));
const auto hiSwapped = htobe64(absl::Uint128High64(i));
return absl::MakeUint128(loSwapped, hiSwapped);
#endif
}

Loading…
Cancel
Save