From aa3a4973a30ff668a62447e18ac41f6c916b4a8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Nov 2020 12:30:59 +1100 Subject: Cleanup: use ELEM macro --- source/blender/blenlib/intern/array_store.c | 2 +- source/blender/blenlib/intern/delaunay_2d.cc | 2 +- source/blender/blenlib/intern/math_boolean.cc | 2 +- source/blender/blenlib/intern/math_matrix.c | 8 ++++---- source/blender/blenlib/intern/mesh_boolean.cc | 2 +- source/blender/blenlib/intern/mesh_intersect.cc | 2 +- source/blender/blenlib/intern/scanfill_utils.c | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index 458fc70afd4..847cb42186a 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -1313,7 +1313,7 @@ static BChunkList *bchunk_list_from_data_merge(const BArrayInfo *info, ASSERT_CHUNKLIST_DATA(chunk_list, data); /* its likely that the next chunk in the list will be a match, so check it! */ - while ((cref_found->next != NULL) && (cref_found->next != chunk_list_reference_last)) { + while (!ELEM(cref_found->next, NULL, chunk_list_reference_last)) { cref_found = cref_found->next; BChunk *chunk_found = cref_found->link; diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index 60439f27b01..568a3206b18 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -2008,7 +2008,7 @@ template void dissolve_symedge(CDT_state *cdt_state, SymEdge * se = sym(se); symse = sym(se); } - if (cdt->outer_face->symedge == se || cdt->outer_face->symedge == symse) { + if (ELEM(cdt->outer_face->symedge, se, symse)) { /* Advancing by 2 to get past possible 'sym(se)'. */ if (se->next->next == se) { cdt->outer_face->symedge = NULL; diff --git a/source/blender/blenlib/intern/math_boolean.cc b/source/blender/blenlib/intern/math_boolean.cc index f8bf8676f50..a345bc1d0af 100644 --- a/source/blender/blenlib/intern/math_boolean.cc +++ b/source/blender/blenlib/intern/math_boolean.cc @@ -470,7 +470,7 @@ void exactinit() } every_other = !every_other; check = 1.0 + epsilon; - } while ((check != 1.0) && (check != lastcheck)); + } while (!ELEM(check, 1.0, lastcheck)); splitter += 1.0; /* Error bounds for orientation and #incircle tests. */ diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 1de69499c8d..6b5efc3f8c4 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -274,7 +274,7 @@ void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]) void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4]) { - BLI_assert(R != A && R != B); + BLI_assert(!ELEM(R, A, B)); /* matrix product: R[j][k] = A[j][i] . B[i][k] */ #ifdef __SSE2__ @@ -319,7 +319,7 @@ void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4]) void mul_m4_m4m4_db_uniq(double R[4][4], const double A[4][4], const double B[4][4]) { - BLI_assert(R != A && R != B); + BLI_assert(!ELEM(R, A, B)); /* matrix product: R[j][k] = A[j][i] . B[i][k] */ @@ -347,7 +347,7 @@ void mul_m4_m4m4_db_uniq(double R[4][4], const double A[4][4], const double B[4] void mul_m4db_m4db_m4fl_uniq(double R[4][4], const double A[4][4], const float B[4][4]) { /* Remove second check since types don't match. */ - BLI_assert(R != A /* && R != B */); + BLI_assert(!ELEM(R, A /*, B */)); /* matrix product: R[j][k] = A[j][i] . B[i][k] */ @@ -419,7 +419,7 @@ void mul_m3_m3_post(float R[3][3], const float B[3][3]) void mul_m3_m3m3_uniq(float R[3][3], const float A[3][3], const float B[3][3]) { - BLI_assert(R != A && R != B); + BLI_assert(!ELEM(R, A, B)); R[0][0] = B[0][0] * A[0][0] + B[0][1] * A[1][0] + B[0][2] * A[2][0]; R[0][1] = B[0][0] * A[0][1] + B[0][1] * A[1][1] + B[0][2] * A[2][1]; diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index bad0b84d10f..c85adf835fe 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -2851,7 +2851,7 @@ static bool dissolve_leaves_valid_bmesh(FaceMergeState *fms, * saying which faces a vertex touches. */ for (int a_v_index = 0; ok && a_v_index < alen; ++a_v_index) { const Vert *a_v = mf_left.vert[a_v_index]; - if (a_v != me.v1 && a_v != me.v2) { + if (!ELEM(a_v, me.v1, me.v2)) { for (int b_v_index = 0; b_v_index < blen; ++b_v_index) { const Vert *b_v = mf_right.vert[b_v_index]; if (a_v == b_v) { diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index a777833dff4..f6579439919 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -2771,7 +2771,7 @@ static CDT_data calc_cluster_subdivided(const CoplanarClusterInfo &clinfo, std::pair key = canon_int_pair(t, t_other); if (itt_map.contains(key)) { ITT_value itt = itt_map.lookup(key); - if (itt.kind != INONE && itt.kind != ICOPLANAR) { + if (!ELEM(itt.kind, INONE, ICOPLANAR)) { itts.append(itt); if (dbg_level > 0) { std::cout << " itt = " << itt << "\n"; diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 660d3dca807..b49239547c2 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -157,14 +157,14 @@ static ScanFillEdge *edge_step(PolyInfo *poly_info, eed = (e_curr->next && e_curr != poly_info[poly_nr].edge_last) ? e_curr->next : poly_info[poly_nr].edge_first; if ((v_curr == eed->v1 || v_curr == eed->v2) == true && - (v_prev == eed->v1 || v_prev == eed->v2) == false) { + (ELEM(v_prev, eed->v1, eed->v2)) == false) { return eed; } eed = (e_curr->prev && e_curr != poly_info[poly_nr].edge_first) ? e_curr->prev : poly_info[poly_nr].edge_last; if ((v_curr == eed->v1 || v_curr == eed->v2) == true && - (v_prev == eed->v1 || v_prev == eed->v2) == false) { + (ELEM(v_prev, eed->v1, eed->v2)) == false) { return eed; } -- cgit v1.2.3