diff --git a/test/test_utility.h b/test/test_utility.h index 1b96140..960a970 100644 --- a/test/test_utility.h +++ b/test/test_utility.h @@ -14,25 +14,25 @@ template constexpr T max_of() { return std::numeric_limits::max( template <> constexpr uint8_t max_of() { return 255; } template -static void random_fill_(T* dst, int n, T minv = min_of(), T maxv = max_of()) +static void random_fill_(T* dst, size_t n, T minv = min_of(), T maxv = max_of()) { std::uniform_int_distribution dist(minv, maxv); - for (int i = 0; i < n; ++i) + for (size_t i = 0; i < n; ++i) dst[i] = dist(g_engine); } template <> -void random_fill_(uint8_t* dst, int n, uint8_t minv, uint8_t maxv) +void random_fill_(uint8_t* dst, size_t n, uint8_t minv, uint8_t maxv) { std::uniform_int_distribution dist(minv, maxv); - for (int i = 0; i < n; ++i) + for (size_t i = 0; i < n; ++i) dst[i] = static_cast(dist(g_engine)); } template static void random_fill_(sgm::HostImage& image, T minv = min_of(), T maxv = max_of()) { - random_fill_(image.ptr(), image.rows * image.step, minv, maxv); + random_fill_(image.ptr(), image.rows * (size_t)image.step, minv, maxv); } static void random_fill(sgm::HostImage& image)