From 81347af9add6e475af716ffdca304d6d9663903f Mon Sep 17 00:00:00 2001 From: Venalicius233 <101078939+Venalicius233@users.noreply.github.com> Date: Fri, 1 Nov 2024 23:42:43 +0800 Subject: [PATCH] Update difflogic_kernel.cu Hi, when i compile difflogic, it failed here. error: expected an expression const union scalar_t_ val = {.signed_scalar = b[row * class_size + i][col / bit_count]}; ^ this error, i don't understand why compiler can't init 2nd variable of the union scalar_t_, so i switch them and then it worked. --- difflogic/cuda/difflogic_kernel.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/difflogic/cuda/difflogic_kernel.cu b/difflogic/cuda/difflogic_kernel.cu index 14b9b42..108c847 100644 --- a/difflogic/cuda/difflogic_kernel.cu +++ b/difflogic/cuda/difflogic_kernel.cu @@ -647,14 +647,14 @@ __global__ void groupbitsum_kernel( typedef typename std::make_unsigned::type unsigned_scalar_t; union scalar_t_ { - unsigned_scalar_t unsigned_scalar; scalar_t signed_scalar; + unsigned_scalar_t unsigned_scalar; }; constexpr int bit_count = std::numeric_limits::digits; int res = 0; const auto class_size = b.size(0) / t.size(0); for (int i = 0; i < class_size; ++i) { - const scalar_t_ val = {.signed_scalar = b[row * class_size + i][col / bit_count]}; + const union scalar_t_ val = {.signed_scalar = b[row * class_size + i][col / bit_count]}; const unsigned_scalar_t bit_mask = static_cast(1) << static_cast(col % bit_count); res += !!(val.unsigned_scalar & bit_mask); }