Skip to content

Commit 93f8e48

Browse files
committed
address comments
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>
1 parent eaa2a8e commit 93f8e48

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/main/cpp/src/protobuf/protobuf.cu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ std::unique_ptr<cudf::column> decode_protobuf_to_struct(cudf::column_view const&
638638
}
639639
};
640640

641+
// `std::size_t = I` works around nvcc #445-D diagnostic.
641642
auto launch_index = [&]<std::size_t I, std::size_t = I>() {
642643
constexpr auto type = SCALAR_KINDS[I].type;
643644
using T = std::conditional_t<type == cudf::type_id::BOOL8, uint8_t, cudf::id_to_type<type>>;

src/main/cpp/src/protobuf/protobuf_kernels.cuh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,18 +298,16 @@ inline scalar_decode_kind get_scalar_decode_kind(proto_encoding encoding)
298298
template <typename T, scalar_decode_kind Decode, typename F>
299299
constexpr void dispatch_scalar_decoder(F&& f)
300300
{
301-
if constexpr (Decode == scalar_decode_kind::FIXED) {
301+
using enum scalar_decode_kind;
302+
if constexpr (Decode == FIXED) {
302303
static_assert(sizeof(T) == 4 || sizeof(T) == 8);
303304
std::forward<F>(f).template operator()<decode_fixed_value<T>>();
304-
} else if constexpr (Decode == scalar_decode_kind::VARINT) {
305-
static_assert(std::is_integral_v<T>);
306-
std::forward<F>(f).template operator()<decode_varint_value<T, false>>();
307-
} else if constexpr (Decode == scalar_decode_kind::ZIGZAG) {
308-
static_assert(std::is_integral_v<T> && std::is_signed_v<T>);
309-
std::forward<F>(f).template operator()<decode_varint_value<T, true>>();
310305
} else {
311-
static_assert(Decode == scalar_decode_kind::FIXED || Decode == scalar_decode_kind::VARINT ||
312-
Decode == scalar_decode_kind::ZIGZAG);
306+
static_assert(Decode == VARINT || Decode == ZIGZAG);
307+
static_assert(std::is_integral_v<T>);
308+
constexpr bool zigzag = Decode == ZIGZAG;
309+
if constexpr (zigzag) { static_assert(std::is_signed_v<T>); }
310+
std::forward<F>(f).template operator()<decode_varint_value<T, zigzag>>();
313311
}
314312
}
315313

0 commit comments

Comments
 (0)