Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-25 11:33:28 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 13:17:08 +0300
commitf68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch)
tree2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/blenlib/tests
parentc7b247a118e302a3afc6473797e53b6af28b69e2 (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r--source/blender/blenlib/tests/BLI_edgehash_test.cc2
-rw-r--r--source/blender/blenlib/tests/BLI_generic_array_test.cc8
-rw-r--r--source/blender/blenlib/tests/BLI_heap_simple_test.cc8
-rw-r--r--source/blender/blenlib/tests/BLI_heap_test.cc20
-rw-r--r--source/blender/blenlib/tests/BLI_kdopbvh_test.cc4
-rw-r--r--source/blender/blenlib/tests/BLI_linear_allocator_test.cc14
-rw-r--r--source/blender/blenlib/tests/BLI_math_color_test.cc2
-rw-r--r--source/blender/blenlib/tests/BLI_math_rotation_test.cc2
-rw-r--r--source/blender/blenlib/tests/BLI_path_util_test.cc2
-rw-r--r--source/blender/blenlib/tests/BLI_polyfill_2d_test.cc4
-rw-r--r--source/blender/blenlib/tests/BLI_string_utf8_test.cc10
-rw-r--r--source/blender/blenlib/tests/BLI_virtual_array_test.cc6
-rw-r--r--source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc6
-rw-r--r--source/blender/blenlib/tests/performance/BLI_task_performance_test.cc4
14 files changed, 46 insertions, 46 deletions
diff --git a/source/blender/blenlib/tests/BLI_edgehash_test.cc b/source/blender/blenlib/tests/BLI_edgehash_test.cc
index 301fa226016..f6e987c7060 100644
--- a/source/blender/blenlib/tests/BLI_edgehash_test.cc
+++ b/source/blender/blenlib/tests/BLI_edgehash_test.cc
@@ -308,7 +308,7 @@ TEST(edgehash, StressTest)
std::vector<Edge> edges;
for (int i = 0; i < amount; i++) {
- edges.push_back({(uint)i, amount + (uint)std::rand() % 12345});
+ edges.push_back({uint(i), amount + uint(std::rand()) % 12345});
}
EdgeHash *eh = BLI_edgehash_new(__func__);
diff --git a/source/blender/blenlib/tests/BLI_generic_array_test.cc b/source/blender/blenlib/tests/BLI_generic_array_test.cc
index 52bc7728a6a..25e08f59f94 100644
--- a/source/blender/blenlib/tests/BLI_generic_array_test.cc
+++ b/source/blender/blenlib/tests/BLI_generic_array_test.cc
@@ -20,7 +20,7 @@ TEST(generic_array, TypeConstructor)
TEST(generic_array, MoveConstructor)
{
- GArray array_a(CPPType::get<int32_t>(), (int64_t)10);
+ GArray array_a(CPPType::get<int32_t>(), int64_t(10));
GMutableSpan span_a = array_a.as_mutable_span();
MutableSpan<int32_t> typed_span_a = span_a.typed<int32_t>();
typed_span_a.fill(42);
@@ -40,7 +40,7 @@ TEST(generic_array, MoveConstructor)
TEST(generic_array, CopyConstructor)
{
- GArray array_a(CPPType::get<int32_t>(), (int64_t)10);
+ GArray array_a(CPPType::get<int32_t>(), int64_t(10));
GMutableSpan span_a = array_a.as_mutable_span();
MutableSpan<int32_t> typed_span_a = span_a.typed<int32_t>();
typed_span_a.fill(42);
@@ -79,7 +79,7 @@ TEST(generic_array, BufferAndSizeConstructor)
TEST(generic_array, Reinitialize)
{
- GArray array(CPPType::get<int32_t>(), (int64_t)5);
+ GArray array(CPPType::get<int32_t>(), int64_t(5));
EXPECT_FALSE(array.data() == nullptr);
GMutableSpan span = array.as_mutable_span();
MutableSpan<int32_t> typed_span = span.typed<int32_t>();
@@ -106,7 +106,7 @@ TEST(generic_array, InContainer)
{
blender::Array<GArray<>> arrays;
for (GArray<> &array : arrays) {
- array = GArray(CPPType::get<int32_t>(), (int64_t)5);
+ array = GArray(CPPType::get<int32_t>(), int64_t(5));
array.as_mutable_span().typed<int32_t>().fill(55);
}
for (GArray<> &array : arrays) {
diff --git a/source/blender/blenlib/tests/BLI_heap_simple_test.cc b/source/blender/blenlib/tests/BLI_heap_simple_test.cc
index 818de67740b..96a5e42374e 100644
--- a/source/blender/blenlib/tests/BLI_heap_simple_test.cc
+++ b/source/blender/blenlib/tests/BLI_heap_simple_test.cc
@@ -18,7 +18,7 @@ static void range_fl(float *array_tar, const int size)
float *array_pt = array_tar + (size - 1);
int i = size;
while (i--) {
- *(array_pt--) = (float)i;
+ *(array_pt--) = float(i);
}
}
@@ -53,7 +53,7 @@ TEST(heap, SimpleRange)
const int items_total = SIZE;
HeapSimple *heap = BLI_heapsimple_new();
for (int in = 0; in < items_total; in++) {
- BLI_heapsimple_insert(heap, (float)in, POINTER_FROM_INT(in));
+ BLI_heapsimple_insert(heap, float(in), POINTER_FROM_INT(in));
}
for (int out_test = 0; out_test < items_total; out_test++) {
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap)));
@@ -67,7 +67,7 @@ TEST(heap, SimpleRangeReverse)
const int items_total = SIZE;
HeapSimple *heap = BLI_heapsimple_new();
for (int in = 0; in < items_total; in++) {
- BLI_heapsimple_insert(heap, (float)-in, POINTER_FROM_INT(-in));
+ BLI_heapsimple_insert(heap, float(-in), POINTER_FROM_INT(-in));
}
for (int out_test = items_total - 1; out_test >= 0; out_test--) {
EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap)));
@@ -97,7 +97,7 @@ static void random_heapsimple_helper(const int items_total, const int random_see
range_fl(values, items_total);
BLI_array_randomize(values, sizeof(float), items_total, random_seed);
for (int i = 0; i < items_total; i++) {
- BLI_heapsimple_insert(heap, values[i], POINTER_FROM_INT((int)values[i]));
+ BLI_heapsimple_insert(heap, values[i], POINTER_FROM_INT(int(values[i])));
}
for (int out_test = 0; out_test < items_total; out_test++) {
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap)));
diff --git a/source/blender/blenlib/tests/BLI_heap_test.cc b/source/blender/blenlib/tests/BLI_heap_test.cc
index 333a1530b6d..f2368ce4abf 100644
--- a/source/blender/blenlib/tests/BLI_heap_test.cc
+++ b/source/blender/blenlib/tests/BLI_heap_test.cc
@@ -17,7 +17,7 @@ static void range_fl(float *array_tar, const int size)
float *array_pt = array_tar + (size - 1);
int i = size;
while (i--) {
- *(array_pt--) = (float)i;
+ *(array_pt--) = float(i);
}
}
@@ -52,7 +52,7 @@ TEST(heap, Range)
const int items_total = SIZE;
Heap *heap = BLI_heap_new();
for (int in = 0; in < items_total; in++) {
- BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
+ BLI_heap_insert(heap, float(in), POINTER_FROM_INT(in));
}
for (int out_test = 0; out_test < items_total; out_test++) {
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
@@ -66,7 +66,7 @@ TEST(heap, RangeReverse)
const int items_total = SIZE;
Heap *heap = BLI_heap_new();
for (int in = 0; in < items_total; in++) {
- BLI_heap_insert(heap, (float)-in, POINTER_FROM_INT(-in));
+ BLI_heap_insert(heap, float(-in), POINTER_FROM_INT(-in));
}
for (int out_test = items_total - 1; out_test >= 0; out_test--) {
EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
@@ -81,7 +81,7 @@ TEST(heap, RangeRemove)
Heap *heap = BLI_heap_new();
HeapNode **nodes = (HeapNode **)MEM_mallocN(sizeof(HeapNode *) * items_total, __func__);
for (int in = 0; in < items_total; in++) {
- nodes[in] = BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
+ nodes[in] = BLI_heap_insert(heap, float(in), POINTER_FROM_INT(in));
}
for (int i = 0; i < items_total; i += 2) {
BLI_heap_remove(heap, nodes[i]);
@@ -116,7 +116,7 @@ static void random_heap_helper(const int items_total, const int random_seed)
range_fl(values, items_total);
BLI_array_randomize(values, sizeof(float), items_total, random_seed);
for (int i = 0; i < items_total; i++) {
- BLI_heap_insert(heap, values[i], POINTER_FROM_INT((int)values[i]));
+ BLI_heap_insert(heap, values[i], POINTER_FROM_INT(int(values[i])));
}
for (int out_test = 0; out_test < items_total; out_test++) {
EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap)));
@@ -145,10 +145,10 @@ TEST(heap, ReInsertSimple)
Heap *heap = BLI_heap_new();
HeapNode **nodes = (HeapNode **)MEM_mallocN(sizeof(HeapNode *) * items_total, __func__);
for (int in = 0; in < items_total; in++) {
- nodes[in] = BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
+ nodes[in] = BLI_heap_insert(heap, float(in), POINTER_FROM_INT(in));
}
for (int i = 0; i < items_total; i++) {
- BLI_heap_node_value_update(heap, nodes[i], (float)(items_total + i));
+ BLI_heap_node_value_update(heap, nodes[i], float(items_total + i));
}
for (int out_test = 0; out_test < items_total; out_test++) {
@@ -165,11 +165,11 @@ static void random_heap_reinsert_helper(const int items_total, const int random_
Heap *heap = BLI_heap_new();
HeapNode **nodes = (HeapNode **)MEM_mallocN(sizeof(HeapNode *) * items_total, __func__);
for (int in = 0; in < items_total; in++) {
- nodes[in] = BLI_heap_insert(heap, (float)in, POINTER_FROM_INT(in));
+ nodes[in] = BLI_heap_insert(heap, float(in), POINTER_FROM_INT(in));
}
BLI_array_randomize(nodes, sizeof(HeapNode *), items_total, random_seed);
for (int i = 0; i < items_total; i++) {
- BLI_heap_node_value_update(heap, nodes[i], (float)i);
+ BLI_heap_node_value_update(heap, nodes[i], float(i));
}
EXPECT_TRUE(BLI_heap_is_valid(heap));
@@ -177,7 +177,7 @@ static void random_heap_reinsert_helper(const int items_total, const int random_
HeapNode *node_top = BLI_heap_top(heap);
float out = BLI_heap_node_value(node_top);
EXPECT_EQ(out, BLI_heap_top_value(heap));
- EXPECT_EQ((float)out_test, out);
+ EXPECT_EQ(float(out_test), out);
BLI_heap_pop_min(heap);
}
EXPECT_TRUE(BLI_heap_is_empty(heap));
diff --git a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc
index 756219cd733..83eeabaea40 100644
--- a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc
+++ b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc
@@ -18,7 +18,7 @@ static void rng_v3_round(float *coords, int coords_len, struct RNG *rng, int rou
{
for (int i = 0; i < coords_len; i++) {
float f = BLI_rng_get_float(rng) * 2.0f - 1.0f;
- coords[i] = ((float)((int)(f * round)) / (float)round) * scale;
+ coords[i] = (float(int(f * round)) / float(round)) * scale;
}
}
@@ -90,7 +90,7 @@ static void find_nearest_points_test(
if (j != i) {
#if 0
const float dist = len_v3v3(points[i], points[j]);
- if (dist > (1.0f / (float)round)) {
+ if (dist > (1.0f / float(round))) {
printf("%.15f (%d %d)\n", dist, i, j);
print_v3_id(points[i]);
print_v3_id(points[j]);
diff --git a/source/blender/blenlib/tests/BLI_linear_allocator_test.cc b/source/blender/blenlib/tests/BLI_linear_allocator_test.cc
index b67683d0558..8f707789954 100644
--- a/source/blender/blenlib/tests/BLI_linear_allocator_test.cc
+++ b/source/blender/blenlib/tests/BLI_linear_allocator_test.cc
@@ -36,13 +36,13 @@ TEST(linear_allocator, PackedAllocation)
blender::AlignedBuffer<256, 32> buffer;
allocator.provide_buffer(buffer);
- uintptr_t ptr1 = (uintptr_t)allocator.allocate(10, 4); /* 0 - 10 */
- uintptr_t ptr2 = (uintptr_t)allocator.allocate(10, 4); /* 12 - 22 */
- uintptr_t ptr3 = (uintptr_t)allocator.allocate(8, 32); /* 32 - 40 */
- uintptr_t ptr4 = (uintptr_t)allocator.allocate(16, 8); /* 40 - 56 */
- uintptr_t ptr5 = (uintptr_t)allocator.allocate(1, 8); /* 56 - 57 */
- uintptr_t ptr6 = (uintptr_t)allocator.allocate(1, 4); /* 60 - 61 */
- uintptr_t ptr7 = (uintptr_t)allocator.allocate(1, 1); /* 61 - 62 */
+ uintptr_t ptr1 = uintptr_t(allocator.allocate(10, 4)); /* 0 - 10 */
+ uintptr_t ptr2 = uintptr_t(allocator.allocate(10, 4)); /* 12 - 22 */
+ uintptr_t ptr3 = uintptr_t(allocator.allocate(8, 32)); /* 32 - 40 */
+ uintptr_t ptr4 = uintptr_t(allocator.allocate(16, 8)); /* 40 - 56 */
+ uintptr_t ptr5 = uintptr_t(allocator.allocate(1, 8)); /* 56 - 57 */
+ uintptr_t ptr6 = uintptr_t(allocator.allocate(1, 4)); /* 60 - 61 */
+ uintptr_t ptr7 = uintptr_t(allocator.allocate(1, 1)); /* 61 - 62 */
EXPECT_EQ(ptr2 - ptr1, 12); /* 12 - 0 = 12 */
EXPECT_EQ(ptr3 - ptr2, 20); /* 32 - 12 = 20 */
diff --git a/source/blender/blenlib/tests/BLI_math_color_test.cc b/source/blender/blenlib/tests/BLI_math_color_test.cc
index 4d928477870..0b6f9340379 100644
--- a/source/blender/blenlib/tests/BLI_math_color_test.cc
+++ b/source/blender/blenlib/tests/BLI_math_color_test.cc
@@ -68,7 +68,7 @@ TEST(math_color, LinearRGBTosRGBRoundtrip)
const int N = 50;
int i;
for (i = 0; i < N; ++i) {
- float orig_linear_color = (float)i / N;
+ float orig_linear_color = float(i) / N;
float srgb_color = linearrgb_to_srgb(orig_linear_color);
float linear_color = srgb_to_linearrgb(srgb_color);
EXPECT_NEAR(orig_linear_color, linear_color, 1e-5);
diff --git a/source/blender/blenlib/tests/BLI_math_rotation_test.cc b/source/blender/blenlib/tests/BLI_math_rotation_test.cc
index 460cfd2d36c..e37b212e1df 100644
--- a/source/blender/blenlib/tests/BLI_math_rotation_test.cc
+++ b/source/blender/blenlib/tests/BLI_math_rotation_test.cc
@@ -161,7 +161,7 @@ static void test_sin_cos_from_fraction_accuracy(const int range, const float exp
for (int i = 0; i < range; i++) {
float sin_cos_fl[2];
sin_cos_from_fraction(i, range, &sin_cos_fl[0], &sin_cos_fl[1]);
- const float phi = (float)(2.0 * M_PI) * ((float)i / (float)range);
+ const float phi = float(2.0 * M_PI) * (float(i) / float(range));
const float sin_cos_test_fl[2] = {sinf(phi), cosf(phi)};
EXPECT_V2_NEAR(sin_cos_fl, sin_cos_test_fl, expected_eps);
}
diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc b/source/blender/blenlib/tests/BLI_path_util_test.cc
index 54afc3d975d..5ea6524f835 100644
--- a/source/blender/blenlib/tests/BLI_path_util_test.cc
+++ b/source/blender/blenlib/tests/BLI_path_util_test.cc
@@ -651,7 +651,7 @@ TEST(path_util, PathRelPath)
abs_path_in[FILE_MAX - 1] = '\0';
abs_path_out[0] = '/';
abs_path_out[1] = '/';
- for (int i = 2; i < FILE_MAX - ((int)ref_path_in_len - 1); i++) {
+ for (int i = 2; i < FILE_MAX - (int(ref_path_in_len) - 1); i++) {
abs_path_out[i] = 'A';
}
abs_path_out[FILE_MAX - (ref_path_in_len - 1)] = '\0';
diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
index 69c60c5bdb9..95fd664217f 100644
--- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
+++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc
@@ -94,10 +94,10 @@ static void test_polyfill_topology(const float /*poly*/[][2],
const uint v2 = tris[i][(j + 1) % 3];
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
if (p) {
- *p = (void *)((intptr_t)*p + (intptr_t)1);
+ *p = (void *)(intptr_t(*p) + intptr_t(1));
}
else {
- BLI_edgehash_insert(edgehash, v1, v2, (void *)(intptr_t)1);
+ BLI_edgehash_insert(edgehash, v1, v2, (void *)intptr_t(1));
}
}
}
diff --git a/source/blender/blenlib/tests/BLI_string_utf8_test.cc b/source/blender/blenlib/tests/BLI_string_utf8_test.cc
index 2da439dad18..7179eef5adb 100644
--- a/source/blender/blenlib/tests/BLI_string_utf8_test.cc
+++ b/source/blender/blenlib/tests/BLI_string_utf8_test.cc
@@ -274,7 +274,7 @@ TEST(string, Utf8InvalidBytes)
for (int i = 0; utf8_invalid_tests[i][0] != nullptr; i++) {
const char *tst = utf8_invalid_tests[i][0];
const char *tst_stripped = utf8_invalid_tests[i][1];
- const int errors_num = (int)utf8_invalid_tests[i][2][0];
+ const int errors_num = int(utf8_invalid_tests[i][2][0]);
char buff[80];
memcpy(buff, tst, sizeof(buff));
@@ -352,13 +352,13 @@ template<size_t Size> void utf8_as_char32_test_at_buffer_size()
/* Offset trailing bytes up and down in steps of 1, 2, 4 .. etc. */
if (Size > 1) {
for (int mul = 1; mul < 256; mul *= 2) {
- for (int ofs = 1; ofs < (int)Size; ofs++) {
- utf8_src[ofs] = (char)(i + (ofs * mul));
+ for (int ofs = 1; ofs < int(Size); ofs++) {
+ utf8_src[ofs] = char(i + (ofs * mul));
}
utf8_as_char32_test_compare<Size>(utf8_src);
- for (int ofs = 1; ofs < (int)Size; ofs++) {
- utf8_src[ofs] = (char)(i - (ofs * mul));
+ for (int ofs = 1; ofs < int(Size); ofs++) {
+ utf8_src[ofs] = char(i - (ofs * mul));
}
utf8_as_char32_test_compare<Size>(utf8_src);
}
diff --git a/source/blender/blenlib/tests/BLI_virtual_array_test.cc b/source/blender/blenlib/tests/BLI_virtual_array_test.cc
index 14f5480f751..6d6580c52d4 100644
--- a/source/blender/blenlib/tests/BLI_virtual_array_test.cc
+++ b/source/blender/blenlib/tests/BLI_virtual_array_test.cc
@@ -98,7 +98,7 @@ TEST(virtual_array, VectorSet)
TEST(virtual_array, Func)
{
- auto func = [](int64_t index) { return (int)(index * index); };
+ auto func = [](int64_t index) { return int(index * index); };
VArray<int> varray = VArray<int>::ForFunc(10, func);
EXPECT_EQ(varray.size(), 10);
EXPECT_EQ(varray[0], 0);
@@ -108,7 +108,7 @@ TEST(virtual_array, Func)
TEST(virtual_array, AsSpan)
{
- auto func = [](int64_t index) { return (int)(10 * index); };
+ auto func = [](int64_t index) { return int(10 * index); };
VArray<int> func_varray = VArray<int>::ForFunc(10, func);
VArraySpan span_varray{func_varray};
EXPECT_EQ(span_varray.size(), 10);
@@ -210,7 +210,7 @@ TEST(virtual_array, MaterializeCompressed)
EXPECT_EQ(compressed_array[2], 4);
}
{
- VArray<int> varray = VArray<int>::ForFunc(10, [](const int64_t i) { return (int)(i * i); });
+ VArray<int> varray = VArray<int>::ForFunc(10, [](const int64_t i) { return int(i * i); });
std::array<int, 3> compressed_array;
varray.materialize_compressed({5, 7, 8}, compressed_array);
EXPECT_EQ(compressed_array[0], 25);
diff --git a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
index e1d3adc6e78..efcf8dea922 100644
--- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
+++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc
@@ -270,7 +270,7 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const uint count)
{
printf("\n========== STARTING %s ==========\n", id);
- uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
+ uint *data = (uint *)MEM_mallocN(sizeof(*data) * size_t(count), __func__);
uint *dt;
uint i;
@@ -379,7 +379,7 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const uint count)
{
printf("\n========== STARTING %s ==========\n", id);
- void *data_v = MEM_mallocN(sizeof(uint[4]) * (size_t)count, __func__);
+ void *data_v = MEM_mallocN(sizeof(uint[4]) * size_t(count), __func__);
uint(*data)[4] = (uint(*)[4])data_v;
uint(*dt)[4];
uint i, j;
@@ -485,7 +485,7 @@ TEST(ghash, Int2NoHash50000000)
static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const uint count)
{
- uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
+ uint *data = (uint *)MEM_mallocN(sizeof(*data) * size_t(count), __func__);
uint *dt;
uint i;
diff --git a/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
index a86e9b0b86d..adebb1edb8b 100644
--- a/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
+++ b/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc
@@ -69,7 +69,7 @@ static void task_listbase_heavy_iter_func(void *UNUSED(userdata),
LinkData *data = (LinkData *)item;
/* 'Random' number of iterations. */
- const uint num = gen_pseudo_random_number((uint)index);
+ const uint num = gen_pseudo_random_number(uint(index));
for (uint i = 0; i < num; i++) {
data->data = POINTER_FROM_INT(POINTER_AS_INT(data->data) + ((i % 2) ? -index : index));
@@ -86,7 +86,7 @@ static void task_listbase_heavy_membarrier_iter_func(void *userdata,
int *count = (int *)userdata;
/* 'Random' number of iterations. */
- const uint num = gen_pseudo_random_number((uint)index);
+ const uint num = gen_pseudo_random_number(uint(index));
for (uint i = 0; i < num; i++) {
data->data = POINTER_FROM_INT(POINTER_AS_INT(data->data) + ((i % 2) ? -index : index));