                 // prev value.
                 //prev_score = __shfl_down_sync(0x1, score, 31);//score;
 
-                if (thread_idx == 31)
+                if (thread_idx == (WARP_SIZE - 1))
                 {
                     prev_score[0] = score;
                 }

    //__shared__ int16_t score_i[1024];
    //__shared__ int16_t score_prev_i[1024];

    uint32_t thread_idx = threadIdx.x;

    long long int start = clock64();

                //uint32_t first_warp_thread_idx = warp * WARP_SIZE;
                //uint32_t last_warp_thread_idx = (warp + 1) * WARP_SIZE - 1;

            if (thread_idx < WARP_SIZE)
            {

                if (thread_idx == 0)
