From e2a62bbbd26240a8f621206fc0e19133c8efd53d Mon Sep 17 00:00:00 2001
From: azharfatrr <m.azhar.faturahman@gmail.com>
Date: Wed, 16 Mar 2022 13:43:23 +0700
Subject: [PATCH] docs: fixing documentation

---
 src/lib/bitonic_sort.cu | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lib/bitonic_sort.cu b/src/lib/bitonic_sort.cu
index 6f2d2a3..7b8c181 100644
--- a/src/lib/bitonic_sort.cu
+++ b/src/lib/bitonic_sort.cu
@@ -104,8 +104,7 @@ void copy_padding(int *dest, int *src, int length, int length_buffer)
 int minimum_blocks(int length, int num_threads) {
   int num_blocks = 1;
 
-  // Increase the number of blocks 2 times 
-  // until the number of threads is less than the length of the array.
+  // Increase the number of blocks 2 times, so it will be a power of 2.
   while (num_blocks * num_threads < length) {
     num_blocks *= 2;
   }
@@ -123,10 +122,11 @@ int minimum_blocks(int length, int num_threads) {
 __global__ void bitonic_sort_step(int *d_arr, int i, int j)
 {
   // The array index and its patner.
-  unsigned int idx, patner;
-  idx = threadIdx.x + blockDim.x * blockIdx.x;
+  int idx, patner;
 
-  // Get the patner.
+  // The thread index.
+  idx = threadIdx.x + blockDim.x * blockIdx.x;
+  // The thread index of the patner.
   patner = idx ^ j;
 
   // Sort the array by threads with the lowest idx.
-- 
GitLab