From 891949cbb47143420f4324cb60efc05ef5d70b39 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 25 Sep 2022 17:04:52 +1000 Subject: Cleanup: use 'u' prefixed integer types for brevity & cast style To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'. --- .../blender/blenlib/tests/BLI_array_store_test.cc | 23 ++--- source/blender/blenlib/tests/BLI_ghash_test.cc | 14 +-- source/blender/blenlib/tests/BLI_hash_mm2a_test.cc | 12 +-- .../blender/blenlib/tests/BLI_polyfill_2d_test.cc | 114 ++++++++++----------- source/blender/blenlib/tests/BLI_stack_cxx_test.cc | 8 +- source/blender/blenlib/tests/BLI_stack_test.cc | 2 +- source/blender/blenlib/tests/BLI_string_test.cc | 6 +- .../performance/BLI_ghash_performance_test.cc | 40 ++++---- 8 files changed, 108 insertions(+), 111 deletions(-) (limited to 'source/blender/blenlib/tests') diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc index 8e95557466e..c52d439308f 100644 --- a/source/blender/blenlib/tests/BLI_array_store_test.cc +++ b/source/blender/blenlib/tests/BLI_array_store_test.cc @@ -168,7 +168,7 @@ static void testbuffer_list_state_from_data__stride_expand(ListBase *lb, #define testbuffer_list_state_from_string_array(lb, data_array) \ { \ - unsigned int i_ = 0; \ + uint i_ = 0; \ const char *data; \ while ((data = data_array[i_++])) { \ testbuffer_list_state_from_data(lb, data, strlen(data)); \ @@ -224,7 +224,7 @@ static bool testbuffer_list_validate(const ListBase *lb) return true; } -static void testbuffer_list_data_randomize(ListBase *lb, unsigned int random_seed) +static void testbuffer_list_data_randomize(ListBase *lb, uint random_seed) { for (TestBuffer *tb = (TestBuffer *)lb->first; tb; tb = tb->next) { BLI_array_randomize((void *)tb->data, 1, tb->data_len, random_seed++); @@ -301,7 +301,7 @@ TEST(array_store, Nop) TEST(array_store, NopState) { BArrayStore *bs = BLI_array_store_create(1, 32); - const unsigned char data[] = "test"; + const uchar data[] = "test"; BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, nullptr); EXPECT_EQ(BLI_array_store_state_size_get(state), sizeof(data) - 1); BLI_array_store_state_remove(bs, state); @@ -556,18 +556,15 @@ TEST(array_store, TextSentencesRandom_Stride128_Chunk6) /* -------------------------------------------------------------------- */ /* Random Data Tests */ -static unsigned int rand_range_i(RNG *rng, - unsigned int min_i, - unsigned int max_i, - unsigned int step) +static uint rand_range_i(RNG *rng, uint min_i, uint max_i, uint step) { if (min_i == max_i) { return min_i; } BLI_assert(min_i <= max_i); BLI_assert(((min_i % step) == 0) && ((max_i % step) == 0)); - unsigned int range = (max_i - min_i); - unsigned int value = BLI_rng_get_uint(rng) % range; + uint range = (max_i - min_i); + uint value = BLI_rng_get_uint(rng) % range; value = (value / step) * step; return min_i + value; } @@ -577,7 +574,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, const size_t data_min_len, const size_t data_max_len, - const unsigned int mutate, + const uint mutate, RNG *rng) { size_t data_len = rand_range_i(rng, data_min_len, data_max_len + stride, stride); @@ -612,7 +609,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, break; } case MUTATE_ADD: { - const unsigned int offset = rand_range_i(rng, 0, data_len, stride); + const uint offset = rand_range_i(rng, 0, data_len, stride); if (data_len < data_max_len) { data_len += stride; data = (char *)MEM_reallocN((void *)data, data_len); @@ -622,7 +619,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, break; } case MUTATE_REMOVE: { - const unsigned int offset = rand_range_i(rng, 0, data_len, stride); + const uint offset = rand_range_i(rng, 0, data_len, stride); if (data_len > data_min_len) { memmove(&data[offset], &data[offset + stride], data_len - (offset + stride)); data_len -= stride; @@ -638,7 +635,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, } case MUTATE_RANDOMIZE: { if (data_len > 0) { - const unsigned int offset = rand_range_i(rng, 0, data_len - stride, stride); + const uint offset = rand_range_i(rng, 0, data_len - stride, stride); BLI_rng_get_char_n(rng, &data[offset], stride); } break; diff --git a/source/blender/blenlib/tests/BLI_ghash_test.cc b/source/blender/blenlib/tests/BLI_ghash_test.cc index da5207cb3f8..5e763dc928f 100644 --- a/source/blender/blenlib/tests/BLI_ghash_test.cc +++ b/source/blender/blenlib/tests/BLI_ghash_test.cc @@ -34,10 +34,10 @@ /* NOTE: for pure-ghash testing, nature of the keys and data have absolutely no importance! So here * we just use mere random integers stored in pointers. */ -static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed) +static void init_keys(uint keys[TESTCASE_SIZE], const int seed) { RNG *rng = BLI_rng_new(seed); - unsigned int *k; + uint *k; int i; for (i = 0, k = keys; i < TESTCASE_SIZE;) { @@ -61,7 +61,7 @@ static void init_keys(unsigned int keys[TESTCASE_SIZE], const int seed) TEST(ghash, InsertLookup) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i; init_keys(keys, 0); @@ -85,7 +85,7 @@ TEST(ghash, InsertLookup) TEST(ghash, InsertRemove) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i, bkt_size; init_keys(keys, 10); @@ -112,7 +112,7 @@ TEST(ghash, InsertRemove) TEST(ghash, InsertRemoveShrink) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i, bkt_size; BLI_ghash_flag_set(ghash, GHASH_FLAG_ALLOW_SHRINK); @@ -141,7 +141,7 @@ TEST(ghash, Copy) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); GHash *ghash_copy; - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i; init_keys(keys, 30); @@ -170,7 +170,7 @@ TEST(ghash, Copy) TEST(ghash, Pop) { GHash *ghash = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__); - unsigned int keys[TESTCASE_SIZE], *k; + uint keys[TESTCASE_SIZE], *k; int i; BLI_ghash_flag_set(ghash, GHASH_FLAG_ALLOW_SHRINK); diff --git a/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc index 99bb107840f..90f5aa6189f 100644 --- a/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc +++ b/source/blender/blenlib/tests/BLI_hash_mm2a_test.cc @@ -16,7 +16,7 @@ TEST(hash_mm2a, MM2ABasic) const char *data = "Blender"; BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data, strlen(data)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data, strlen(data)); #ifdef __LITTLE_ENDIAN__ EXPECT_EQ(BLI_hash_mm2a_end(&mm2), 1633988145); #else @@ -35,12 +35,12 @@ TEST(hash_mm2a, MM2AConcatenateStrings) const char *data123 = "Blender is FaNtAsTiC"; BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data1, strlen(data1)); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data2, strlen(data2)); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data3, strlen(data3)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data1, strlen(data1)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data2, strlen(data2)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data3, strlen(data3)); hash = BLI_hash_mm2a_end(&mm2); BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)data123, strlen(data123)); + BLI_hash_mm2a_add(&mm2, (const uchar *)data123, strlen(data123)); #ifdef __LITTLE_ENDIAN__ EXPECT_EQ(hash, 1545105348); #else @@ -63,7 +63,7 @@ TEST(hash_mm2a, MM2AIntegers) BLI_hash_mm2a_add_int(&mm2, ints[3]); hash = BLI_hash_mm2a_end(&mm2); BLI_hash_mm2a_init(&mm2, 0); - BLI_hash_mm2a_add(&mm2, (const unsigned char *)ints, sizeof(ints)); + BLI_hash_mm2a_add(&mm2, (const uchar *)ints, sizeof(ints)); /* Yes, same hash here on little and big endian. */ #ifdef __LITTLE_ENDIAN__ EXPECT_EQ(hash, 405493096); diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc index db2fb1ba671..69c60c5bdb9 100644 --- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc @@ -29,20 +29,20 @@ static void polyfill_to_obj(const char *id, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num); + const uint poly_num, + const uint tris[][3], + const uint tris_num); /* -------------------------------------------------------------------- */ /* test utility functions */ -#define TRI_ERROR_VALUE (unsigned int)-1 +#define TRI_ERROR_VALUE (uint) - 1 -static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tris_num) +static void test_valid_polyfill_prepare(uint tris[][3], uint tris_num) { - unsigned int i; + uint i; for (i = 0; i < tris_num; i++) { - unsigned int j; + uint j; for (j = 0; j < 3; j++) { tris[i][j] = TRI_ERROR_VALUE; } @@ -57,14 +57,14 @@ static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tri * - all verts used at least once. */ static void test_polyfill_simple(const float /*poly*/[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { - unsigned int i; + uint i; int *used_num = (int *)MEM_callocN(poly_num * sizeof(int), __func__); for (i = 0; i < tris_num; i++) { - unsigned int j; + uint j; for (j = 0; j < 3; j++) { EXPECT_NE(TRI_ERROR_VALUE, tris[i][j]); used_num[tris[i][j]] += 1; @@ -80,18 +80,18 @@ static void test_polyfill_simple(const float /*poly*/[][2], } static void test_polyfill_topology(const float /*poly*/[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { EdgeHash *edgehash = BLI_edgehash_new(__func__); EdgeHashIterator *ehi; - unsigned int i; + uint i; for (i = 0; i < tris_num; i++) { - unsigned int j; + uint j; for (j = 0; j < 3; j++) { - const unsigned int v1 = tris[i][j]; - const unsigned int v2 = tris[i][(j + 1) % 3]; + const uint v1 = tris[i][j]; + 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); @@ -104,8 +104,8 @@ static void test_polyfill_topology(const float /*poly*/[][2], EXPECT_EQ(BLI_edgehash_len(edgehash), poly_num + (poly_num - 3)); for (i = 0; i < poly_num; i++) { - const unsigned int v1 = i; - const unsigned int v2 = (i + 1) % poly_num; + const uint v1 = i; + const uint v2 = (i + 1) % poly_num; void **p = BLI_edgehash_lookup_p(edgehash, v1, v2); EXPECT_NE((void *)p, nullptr); EXPECT_EQ((intptr_t)*p, 1); @@ -125,12 +125,12 @@ static void test_polyfill_topology(const float /*poly*/[][2], * Check all faces are flipped the same way */ static void test_polyfill_winding(const float poly[][2], - const unsigned int /*poly_num*/, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint /*poly_num*/, + const uint tris[][3], + const uint tris_num) { - unsigned int i; - unsigned int count[2] = {0, 0}; + uint i; + uint count[2] = {0, 0}; for (i = 0; i < tris_num; i++) { float winding_test = cross_tri_v2(poly[tris[i][0]], poly[tris[i][1]], poly[tris[i][2]]); if (fabsf(winding_test) > FLT_EPSILON) { @@ -144,11 +144,11 @@ static void test_polyfill_winding(const float poly[][2], * Check the accumulated triangle area is close to the original area. */ static void test_polyfill_area(const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { - unsigned int i; + uint i; const float area_total = area_poly_v2(poly, poly_num); float area_total_tris = 0.0f; const float eps_abs = 0.00001f; @@ -167,9 +167,9 @@ static void test_polyfill_area(const float poly[][2], static void test_polyfill_template_check(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { test_polyfill_simple(poly, poly_num, tris, tris_num); test_polyfill_topology(poly, poly_num, tris, tris_num); @@ -184,9 +184,9 @@ static void test_polyfill_template_check(const char *id, static void test_polyfill_template(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { test_valid_polyfill_prepare(tris, tris_num); BLI_polyfill_calc(poly, poly_num, 0, tris); @@ -213,9 +213,9 @@ static void test_polyfill_template(const char *id, static void test_polyfill_template_flip_sign(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { float(*poly_copy)[2] = (float(*)[2])MEM_mallocN(sizeof(float[2]) * poly_num, id); for (int flip_x = 0; flip_x < 2; flip_x++) { @@ -236,19 +236,19 @@ static void test_polyfill_template_flip_sign(const char *id, static void test_polyfill_template_main(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { /* overkill? - try at _every_ offset & reverse */ - unsigned int poly_reverse; + uint poly_reverse; float(*poly_copy)[2] = (float(*)[2])MEM_mallocN(sizeof(float[2]) * poly_num, id); float tmp[2]; memcpy(poly_copy, poly, sizeof(float[2]) * poly_num); for (poly_reverse = 0; poly_reverse < 2; poly_reverse++) { - unsigned int poly_cycle; + uint poly_cycle; if (poly_reverse) { BLI_array_reverse(poly_copy, poly_num); @@ -271,9 +271,9 @@ static void test_polyfill_template_main(const char *id, static void test_polyfill_template_main(const char *id, bool is_degenerate, const float poly[][2], - const unsigned int poly_num, - unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + uint tris[][3], + const uint tris_num) { test_polyfill_template_flip_sign(id, is_degenerate, poly, poly_num, tris, tris_num); } @@ -281,9 +281,9 @@ static void test_polyfill_template_main(const char *id, #define TEST_POLYFILL_TEMPLATE_STATIC(poly, is_degenerate) \ { \ - unsigned int tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \ - const unsigned int poly_num = ARRAY_SIZE(poly); \ - const unsigned int tris_num = ARRAY_SIZE(tris); \ + uint tris[POLY_TRI_COUNT(ARRAY_SIZE(poly))][3]; \ + const uint poly_num = ARRAY_SIZE(poly); \ + const uint tris_num = ARRAY_SIZE(tris); \ const char *id = typeid(*this).name(); \ \ test_polyfill_template_main(id, is_degenerate, poly, poly_num, tris, tris_num); \ @@ -296,13 +296,13 @@ static void test_polyfill_template_main(const char *id, #ifdef USE_OBJ_PREVIEW static void polyfill_to_obj(const char *id, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { char path[1024]; FILE *f; - unsigned int i; + uint i; BLI_snprintf(path, sizeof(path), "%s.obj", id); @@ -324,9 +324,9 @@ static void polyfill_to_obj(const char *id, #else static void polyfill_to_obj(const char *id, const float poly[][2], - const unsigned int poly_num, - const unsigned int tris[][3], - const unsigned int tris_num) + const uint poly_num, + const uint tris[][3], + const uint tris_num) { (void)id; (void)poly, (void)poly_num; diff --git a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc index 0707759666d..5c7f1106993 100644 --- a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc @@ -118,19 +118,19 @@ TEST(stack, PushPopMany) Stack stack; for (int i = 0; i < 1000; i++) { stack.push(i); - EXPECT_EQ(stack.size(), static_cast(i + 1)); + EXPECT_EQ(stack.size(), static_cast(i + 1)); } for (int i = 999; i > 50; i--) { EXPECT_EQ(stack.pop(), i); - EXPECT_EQ(stack.size(), static_cast(i)); + EXPECT_EQ(stack.size(), static_cast(i)); } for (int i = 51; i < 5000; i++) { stack.push(i); - EXPECT_EQ(stack.size(), static_cast(i + 1)); + EXPECT_EQ(stack.size(), static_cast(i + 1)); } for (int i = 4999; i >= 0; i--) { EXPECT_EQ(stack.pop(), i); - EXPECT_EQ(stack.size(), static_cast(i)); + EXPECT_EQ(stack.size(), static_cast(i)); } } diff --git a/source/blender/blenlib/tests/BLI_stack_test.cc b/source/blender/blenlib/tests/BLI_stack_test.cc index 216c8bd6d55..5f361a78929 100644 --- a/source/blender/blenlib/tests/BLI_stack_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_test.cc @@ -28,7 +28,7 @@ TEST(stack, Empty) TEST(stack, One) { BLI_Stack *stack; - unsigned int in = -1, out = 1; + uint in = -1, out = 1; stack = BLI_stack_new(sizeof(in), __func__); diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc index eaaa65dd39f..9bdf6075c70 100644 --- a/source/blender/blenlib/tests/BLI_string_test.cc +++ b/source/blender/blenlib/tests/BLI_string_test.cc @@ -174,7 +174,7 @@ TEST(string, StrPartitionEx) /* BLI_str_partition_utf8 */ TEST(string, StrPartitionUtf8) { - const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; + const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; const char *sep, *suf; size_t pre_len; @@ -233,7 +233,7 @@ TEST(string, StrPartitionUtf8) /* BLI_str_rpartition_utf8 */ TEST(string, StrRPartitionUtf8) { - const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; + const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; const char *sep, *suf; size_t pre_len; @@ -292,7 +292,7 @@ TEST(string, StrRPartitionUtf8) /* BLI_str_partition_ex_utf8 */ TEST(string, StrPartitionExUtf8) { - const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; + const uint delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'}; const char *sep, *suf; size_t pre_len; 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 09bb1e7239f..e1d3adc6e78 100644 --- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc @@ -177,12 +177,12 @@ TEST(ghash, TextMurmur2a) /* Int: uniform 100M first integers. */ -static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void int_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); { - unsigned int i = count; + uint i = count; TIMEIT_START(int_insert); @@ -200,7 +200,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int cou PRINTF_GHASH_STATS(ghash); { - unsigned int i = count; + uint i = count; TIMEIT_START(int_lookup); @@ -266,13 +266,13 @@ TEST(ghash, IntMurmur2a100000000) /* Int: random 50M integers. */ -static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void randint_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); - unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); - unsigned int *dt; - unsigned int i; + uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); + uint *dt; + uint i; { RNG *rng = BLI_rng_new(1); @@ -347,7 +347,7 @@ TEST(ghash, IntRandMurmur2a50000000) } #endif -static unsigned int ghashutil_tests_nohash_p(const void *p) +static uint ghashutil_tests_nohash_p(const void *p) { return POINTER_AS_UINT(p); } @@ -375,14 +375,14 @@ TEST(ghash, Int4NoHash50000000) /* Int_v4: 20M of randomly-generated integer vectors. */ -static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +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(unsigned int[4]) * (size_t)count, __func__); - unsigned int(*data)[4] = (unsigned int(*)[4])data_v; - unsigned int(*dt)[4]; - unsigned int i, j; + 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; { RNG *rng = BLI_rng_new(1); @@ -483,11 +483,11 @@ TEST(ghash, Int2NoHash50000000) /* MultiSmall: create and manipulate a lot of very small ghash's * (90% < 10 items, 9% < 100 items, 1% < 1000 items). */ -static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned int count) +static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const uint count) { - unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); - unsigned int *dt; - unsigned int i; + uint *data = (uint *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__); + uint *dt; + uint i; for (i = count, dt = data; i--; dt++) { *dt = BLI_rng_get_uint(rng); @@ -510,7 +510,7 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i MEM_freeN(data); } -static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned int count) +static void multi_small_ghash_tests(GHash *ghash, const char *id, const uint count) { printf("\n========== STARTING %s ==========\n", id); @@ -518,7 +518,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned TIMEIT_START(multi_small_ghash); - unsigned int i = count; + uint i = count; while (i--) { const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) * (!(i % 100) ? 100 : (!(i % 10) ? 10 : 1)); @@ -529,7 +529,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned TIMEIT_START(multi_small2_ghash); - unsigned int i = count; + uint i = count; while (i--) { const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) / 2 * (!(i % 100) ? 100 : (!(i % 10) ? 10 : 1)); -- cgit v1.2.3