diff options
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/dot_export.cc | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_boolean.cc | 58 | ||||
-rw-r--r-- | source/blender/blenlib/intern/noise.cc | 42 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rand.cc | 20 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string_search.cc | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/threads.cc | 4 |
6 files changed, 66 insertions, 66 deletions
diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc index 796fd6a934a..d577de9bc34 100644 --- a/source/blender/blenlib/intern/dot_export.cc +++ b/source/blender/blenlib/intern/dot_export.cc @@ -93,7 +93,7 @@ void Graph::set_random_cluster_bgcolors() void Cluster::set_random_cluster_bgcolors() { - float hue = rand() / (float)RAND_MAX; + float hue = rand() / float(RAND_MAX); float staturation = 0.3f; float value = 0.8f; this->attributes.set("bgcolor", color_attr_from_hsv(hue, staturation, value)); @@ -227,7 +227,7 @@ void Attributes::export__as_bracket_list(std::stringstream &ss) const void Node::export__as_id(std::stringstream &ss) const { - ss << '"' << (uintptr_t)this << '"'; + ss << '"' << uintptr_t(this) << '"'; } void Node::export__as_declaration(std::stringstream &ss) const diff --git a/source/blender/blenlib/intern/math_boolean.cc b/source/blender/blenlib/intern/math_boolean.cc index 132d5dfda65..871ea815e90 100644 --- a/source/blender/blenlib/intern/math_boolean.cc +++ b/source/blender/blenlib/intern/math_boolean.cc @@ -193,7 +193,7 @@ static RobustInitCaller init_caller; y = b - bvirt #define Fast_Two_Sum(a, b, x, y) \ - x = (double)(a + b); \ + x = double(a + b); \ Fast_Two_Sum_Tail(a, b, x, y) #define Fast_Two_Diff_Tail(a, b, x, y) \ @@ -205,30 +205,30 @@ static RobustInitCaller init_caller; Fast_Two_Diff_Tail(a, b, x, y) #define Two_Sum_Tail(a, b, x, y) \ - bvirt = (double)(x - a); \ + bvirt = double(x - a); \ avirt = x - bvirt; \ bround = b - bvirt; \ around = a - avirt; \ y = around + bround #define Two_Sum(a, b, x, y) \ - x = (double)(a + b); \ + x = double(a + b); \ Two_Sum_Tail(a, b, x, y) #define Two_Diff_Tail(a, b, x, y) \ - bvirt = (double)(a - x); \ + bvirt = double(a - x); \ avirt = x + bvirt; \ bround = bvirt - b; \ around = a - avirt; \ y = around + bround #define Two_Diff(a, b, x, y) \ - x = (double)(a - b); \ + x = double(a - b); \ Two_Diff_Tail(a, b, x, y) #define Split(a, ahi, alo) \ - c = (double)(splitter * a); \ - abig = (double)(c - a); \ + c = double(splitter * a); \ + abig = double(c - a); \ ahi = c - abig; \ alo = a - ahi @@ -241,11 +241,11 @@ static RobustInitCaller init_caller; y = (alo * blo) - err3 #define Two_Product(a, b, x, y) \ - x = (double)(a * b); \ + x = double(a * b); \ Two_Product_Tail(a, b, x, y) #define Two_Product_Presplit(a, b, bhi, blo, x, y) \ - x = (double)(a * b); \ + x = double(a * b); \ Split(a, ahi, alo); \ err1 = x - (ahi * bhi); \ err2 = err1 - (alo * bhi); \ @@ -266,7 +266,7 @@ static RobustInitCaller init_caller; y = (alo * alo) - err3 #define Square(a, x, y) \ - x = (double)(a * a); \ + x = double(a * a); \ Square_Tail(a, x, y) #define Two_One_Sum(a1, a0, b, x2, x1, x0) \ @@ -647,10 +647,10 @@ static double orient2dadapt(const double *pa, const double *pb, const double *pc INEXACT double _i, _j; double _0; - acx = (double)(pa[0] - pc[0]); - bcx = (double)(pb[0] - pc[0]); - acy = (double)(pa[1] - pc[1]); - bcy = (double)(pb[1] - pc[1]); + acx = double(pa[0] - pc[0]); + bcx = double(pb[0] - pc[0]); + acy = double(pa[1] - pc[1]); + bcy = double(pb[1] - pc[1]); Two_Product(acx, bcy, detleft, detlefttail); Two_Product(acy, bcx, detright, detrighttail); @@ -834,15 +834,15 @@ static double orient3dadapt( INEXACT double _i, _j, _k; double _0; - adx = (double)(pa[0] - pd[0]); - bdx = (double)(pb[0] - pd[0]); - cdx = (double)(pc[0] - pd[0]); - ady = (double)(pa[1] - pd[1]); - bdy = (double)(pb[1] - pd[1]); - cdy = (double)(pc[1] - pd[1]); - adz = (double)(pa[2] - pd[2]); - bdz = (double)(pb[2] - pd[2]); - cdz = (double)(pc[2] - pd[2]); + adx = double(pa[0] - pd[0]); + bdx = double(pb[0] - pd[0]); + cdx = double(pc[0] - pd[0]); + ady = double(pa[1] - pd[1]); + bdy = double(pb[1] - pd[1]); + cdy = double(pc[1] - pd[1]); + adz = double(pa[2] - pd[2]); + bdz = double(pb[2] - pd[2]); + cdz = double(pc[2] - pd[2]); Two_Product(bdx, cdy, bdxcdy1, bdxcdy0); Two_Product(cdx, bdy, cdxbdy1, cdxbdy0); @@ -1358,12 +1358,12 @@ static double incircleadapt( INEXACT double _i, _j; double _0; - adx = (double)(pa[0] - pd[0]); - bdx = (double)(pb[0] - pd[0]); - cdx = (double)(pc[0] - pd[0]); - ady = (double)(pa[1] - pd[1]); - bdy = (double)(pb[1] - pd[1]); - cdy = (double)(pc[1] - pd[1]); + adx = double(pa[0] - pd[0]); + bdx = double(pb[0] - pd[0]); + cdx = double(pc[0] - pd[0]); + ady = double(pa[1] - pd[1]); + bdy = double(pb[1] - pd[1]); + cdy = double(pc[1] - pd[1]); Two_Product(bdx, cdy, bdxcdy1, bdxcdy0); Two_Product(cdx, bdy, cdxbdy1, cdxbdy0); diff --git a/source/blender/blenlib/intern/noise.cc b/source/blender/blenlib/intern/noise.cc index 19c4b92a315..65a6f102a7b 100644 --- a/source/blender/blenlib/intern/noise.cc +++ b/source/blender/blenlib/intern/noise.cc @@ -379,7 +379,7 @@ BLI_INLINE float noise_grad(uint32_t hash, float x, float y, float z, float w) BLI_INLINE float floor_fraction(float x, int &i) { - i = (int)x - ((x < 0) ? 1 : 0); + i = int(x) - ((x < 0) ? 1 : 0); return x - i; } @@ -729,7 +729,7 @@ float musgrave_fBm(const float co, const float pwHL = std::pow(lacunarity, -H); const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value += perlin_signed(p) * pwr; pwr *= pwHL; p *= lacunarity; @@ -754,7 +754,7 @@ float musgrave_multi_fractal(const float co, const float pwHL = std::pow(lacunarity, -H); const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value *= (pwr * perlin_signed(p) + 1.0f); pwr *= pwHL; p *= lacunarity; @@ -783,7 +783,7 @@ float musgrave_hetero_terrain(const float co, float value = offset + perlin_signed(p); p *= lacunarity; - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { float increment = (perlin_signed(p) + offset) * pwr * value; value += increment; pwr *= pwHL; @@ -815,7 +815,7 @@ float musgrave_hybrid_multi_fractal(const float co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) { + for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) { if (weight > 1.0f) { weight = 1.0f; } @@ -857,7 +857,7 @@ float musgrave_ridged_multi_fractal(const float co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { p *= lacunarity; weight = CLAMPIS(signal * gain, 0.0f, 1.0f); signal = offset - std::abs(perlin_signed(p)); @@ -883,7 +883,7 @@ float musgrave_fBm(const float2 co, const float pwHL = std::pow(lacunarity, -H); const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value += perlin_signed(p) * pwr; pwr *= pwHL; p *= lacunarity; @@ -908,7 +908,7 @@ float musgrave_multi_fractal(const float2 co, const float pwHL = std::pow(lacunarity, -H); const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value *= (pwr * perlin_signed(p) + 1.0f); pwr *= pwHL; p *= lacunarity; @@ -938,7 +938,7 @@ float musgrave_hetero_terrain(const float2 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { float increment = (perlin_signed(p) + offset) * pwr * value; value += increment; pwr *= pwHL; @@ -970,7 +970,7 @@ float musgrave_hybrid_multi_fractal(const float2 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) { + for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) { if (weight > 1.0f) { weight = 1.0f; } @@ -1012,7 +1012,7 @@ float musgrave_ridged_multi_fractal(const float2 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { p *= lacunarity; weight = CLAMPIS(signal * gain, 0.0f, 1.0f); signal = offset - std::abs(perlin_signed(p)); @@ -1039,7 +1039,7 @@ float musgrave_fBm(const float3 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value += perlin_signed(p) * pwr; pwr *= pwHL; p *= lacunarity; @@ -1065,7 +1065,7 @@ float musgrave_multi_fractal(const float3 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value *= (pwr * perlin_signed(p) + 1.0f); pwr *= pwHL; p *= lacunarity; @@ -1095,7 +1095,7 @@ float musgrave_hetero_terrain(const float3 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { float increment = (perlin_signed(p) + offset) * pwr * value; value += increment; pwr *= pwHL; @@ -1127,7 +1127,7 @@ float musgrave_hybrid_multi_fractal(const float3 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) { + for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) { if (weight > 1.0f) { weight = 1.0f; } @@ -1169,7 +1169,7 @@ float musgrave_ridged_multi_fractal(const float3 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { p *= lacunarity; weight = CLAMPIS(signal * gain, 0.0f, 1.0f); signal = offset - std::abs(perlin_signed(p)); @@ -1196,7 +1196,7 @@ float musgrave_fBm(const float4 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value += perlin_signed(p) * pwr; pwr *= pwHL; p *= lacunarity; @@ -1222,7 +1222,7 @@ float musgrave_multi_fractal(const float4 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; i < (int)octaves; i++) { + for (int i = 0; i < int(octaves); i++) { value *= (pwr * perlin_signed(p) + 1.0f); pwr *= pwHL; p *= lacunarity; @@ -1252,7 +1252,7 @@ float musgrave_hetero_terrain(const float4 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { float increment = (perlin_signed(p) + offset) * pwr * value; value += increment; pwr *= pwHL; @@ -1284,7 +1284,7 @@ float musgrave_hybrid_multi_fractal(const float4 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 0; (weight > 0.001f) && (i < (int)octaves); i++) { + for (int i = 0; (weight > 0.001f) && (i < int(octaves)); i++) { if (weight > 1.0f) { weight = 1.0f; } @@ -1326,7 +1326,7 @@ float musgrave_ridged_multi_fractal(const float4 co, const float octaves = CLAMPIS(octaves_unclamped, 0.0f, 15.0f); - for (int i = 1; i < (int)octaves; i++) { + for (int i = 1; i < int(octaves); i++) { p *= lacunarity; weight = CLAMPIS(signal * gain, 0.0f, 1.0f); signal = offset - std::abs(perlin_signed(p)); diff --git a/source/blender/blenlib/intern/rand.cc b/source/blender/blenlib/intern/rand.cc index b5db0d6b473..2e9b15c623e 100644 --- a/source/blender/blenlib/intern/rand.cc +++ b/source/blender/blenlib/intern/rand.cc @@ -161,7 +161,7 @@ void BLI_rng_shuffle_bitmap(struct RNG *rng, BLI_bitmap *bitmap, uint bits_num) void BLI_rng_skip(RNG *rng, int n) { - rng->rng.skip((uint)n); + rng->rng.skip(uint(n)); } /***/ @@ -239,7 +239,7 @@ RNG_THREAD_ARRAY *BLI_rng_threaded_new() "random_array"); for (i = 0; i < BLENDER_MAX_THREADS; i++) { - BLI_rng_srandom(&rngarr->rng_tab[i], (uint)clock()); + BLI_rng_srandom(&rngarr->rng_tab[i], uint(clock())); } return rngarr; @@ -283,7 +283,7 @@ BLI_INLINE double halton_ex(double invprimes, double *offset) void BLI_halton_1d(uint prime, double offset, int n, double *r) { - const double invprime = 1.0 / (double)prime; + const double invprime = 1.0 / double(prime); *r = 0.0; @@ -294,7 +294,7 @@ void BLI_halton_1d(uint prime, double offset, int n, double *r) void BLI_halton_2d(const uint prime[2], double offset[2], int n, double *r) { - const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; + const double invprimes[2] = {1.0 / double(prime[0]), 1.0 / double(prime[1])}; r[0] = r[1] = 0.0; @@ -308,7 +308,7 @@ void BLI_halton_2d(const uint prime[2], double offset[2], int n, double *r) void BLI_halton_3d(const uint prime[3], double offset[3], int n, double *r) { const double invprimes[3] = { - 1.0 / (double)prime[0], 1.0 / (double)prime[1], 1.0 / (double)prime[2]}; + 1.0 / double(prime[0]), 1.0 / double(prime[1]), 1.0 / double(prime[2])}; r[0] = r[1] = r[2] = 0.0; @@ -321,7 +321,7 @@ void BLI_halton_3d(const uint prime[3], double offset[3], int n, double *r) void BLI_halton_2d_sequence(const uint prime[2], double offset[2], int n, double *r) { - const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / (double)prime[1]}; + const double invprimes[2] = {1.0 / double(prime[0]), 1.0 / double(prime[1])}; for (int s = 0; s < n; s++) { for (int i = 0; i < 2; i++) { @@ -355,7 +355,7 @@ void BLI_hammersley_1d(uint n, double *r) void BLI_hammersley_2d_sequence(uint n, double *r) { for (uint s = 0; s < n; s++) { - r[s * 2 + 0] = (double)(s + 0.5) / (double)n; + r[s * 2 + 0] = double(s + 0.5) / double(n); r[s * 2 + 1] = radical_inverse(s); } } @@ -377,12 +377,12 @@ int RandomNumberGenerator::round_probabilistic(float x) BLI_assert(x >= 0.0f); const float round_up_probability = fractf(x); const bool round_up = round_up_probability > this->get_float(); - return (int)x + (int)round_up; + return int(x) + int(round_up); } float2 RandomNumberGenerator::get_unit_float2() { - float a = (float)(M_PI * 2.0) * this->get_float(); + float a = float(M_PI * 2.0) * this->get_float(); return {cosf(a), sinf(a)}; } @@ -391,7 +391,7 @@ float3 RandomNumberGenerator::get_unit_float3() float z = (2.0f * this->get_float()) - 1.0f; float r = 1.0f - z * z; if (r > 0.0f) { - float a = (float)(M_PI * 2.0) * this->get_float(); + float a = float(M_PI * 2.0) * this->get_float(); r = sqrtf(r); float x = r * cosf(a); float y = r * sinf(a); diff --git a/source/blender/blenlib/intern/string_search.cc b/source/blender/blenlib/intern/string_search.cc index 6eeae307fc1..f87304863c9 100644 --- a/source/blender/blenlib/intern/string_search.cc +++ b/source/blender/blenlib/intern/string_search.cc @@ -345,7 +345,7 @@ void extract_normalized_words(StringRef str, LinearAllocator<> &allocator, Vector<StringRef, 64> &r_words) { - const uint32_t unicode_space = (uint32_t)' '; + const uint32_t unicode_space = uint32_t(' '); const uint32_t unicode_right_triangle = UI_MENU_ARROW_SEP_UNICODE; BLI_assert(unicode_space == BLI_str_utf8_as_unicode(" ")); @@ -418,7 +418,7 @@ void BLI_string_search_add(StringSearch *search, StringRef str_ref{str}; string_search::extract_normalized_words(str_ref, search->allocator, words); search->items.append({search->allocator.construct_array_copy(words.as_span()), - (int)str_ref.size(), + int(str_ref.size()), user_data, weight}); } diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index e7470ed86f8..156f2a7b338 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -293,7 +293,7 @@ int BLI_system_thread_count() #ifdef WIN32 SYSTEM_INFO info; GetSystemInfo(&info); - t = (int)info.dwNumberOfProcessors; + t = int(info.dwNumberOfProcessors); #else # ifdef __APPLE__ int mib[2]; @@ -304,7 +304,7 @@ int BLI_system_thread_count() len = sizeof(t); sysctl(mib, 2, &t, &len, nullptr, 0); # else - t = (int)sysconf(_SC_NPROCESSORS_ONLN); + t = int(sysconf(_SC_NPROCESSORS_ONLN)); # endif #endif } |