Skip to content

Commit

Permalink
[Misc] Fix signed unsigned comparison warning (#6602)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfbalin authored Nov 23, 2023
1 parent 1b3f14b commit 5e78e07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/array/cuda/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <dgl/runtime/ndarray.h>
#include <dmlc/logging.h>

#include <type_traits>

#include "../../runtime/cuda/cuda_common.h"
#include "dgl_cub.cuh"

Expand Down Expand Up @@ -46,7 +48,8 @@ int _NumberOfBits(const T& range) {
}

int bits = 1;
while (bits < static_cast<int>(sizeof(T) * 8) && (1ull << bits) < range) {
const auto urange = static_cast<std::make_unsigned_t<T>>(range);
while (bits < static_cast<int>(sizeof(T) * 8) && (1ull << bits) < urange) {
++bits;
}

Expand Down

0 comments on commit 5e78e07

Please sign in to comment.