From 8bdb6de626386ef7936477a5702fa14c82ead5c6 Mon Sep 17 00:00:00 2001 From: mohsaka <135669458+mohsaka@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:36:38 -0700 Subject: [PATCH] Make const uint8_t to remove cast --- velox/functions/prestosql/types/IPAddressType.h | 2 +- velox/functions/prestosql/types/IPPrefixType.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/velox/functions/prestosql/types/IPAddressType.h b/velox/functions/prestosql/types/IPAddressType.h index 1d6f81c1246f2..2c85acf63aa02 100644 --- a/velox/functions/prestosql/types/IPAddressType.h +++ b/velox/functions/prestosql/types/IPAddressType.h @@ -21,7 +21,7 @@ static constexpr int kIPAddressBytes = 16; static constexpr int kIPPrefixBytes = 17; static constexpr int kIPV4Bits = 32; -static constexpr int kIPV6Bits = 128; +static constexpr uint8_t kIPV6Bits = 128; namespace facebook::velox { diff --git a/velox/functions/prestosql/types/IPPrefixType.cpp b/velox/functions/prestosql/types/IPPrefixType.cpp index d77bc7e2be119..c32250dd745ad 100644 --- a/velox/functions/prestosql/types/IPPrefixType.cpp +++ b/velox/functions/prestosql/types/IPPrefixType.cpp @@ -274,7 +274,7 @@ class IPPrefixCastOperator : public exec::CastOperator { if (v6Addr.isIPv4Mapped()) { result.data()[kIPAddressBytes] = kIPV4Bits; } else { - result.data()[kIPAddressBytes] = (unsigned char)kIPV6Bits; + result.data()[kIPAddressBytes] = kIPV6Bits; } result.finalize();