From bb3ec3ebafbc2c0e5d8530148a433242e0adad30 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Sep 2018 12:05:58 +1000 Subject: BLI_utildefines: rename pointer conversion macros Terms get/set don't make much sense when casting values. Name macros so the conversion is obvious, use common prefix for easier completion. - GET_INT_FROM_POINTER -> POINTER_AS_INT - SET_INT_IN_POINTER -> POINTER_FROM_INT - GET_UINT_FROM_POINTER -> POINTER_AS_UINT - SET_UINT_IN_POINTER -> POINTER_FROM_UINT --- source/blender/blenkernel/intern/pbvh.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/blenkernel/intern/pbvh.c') diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 772cda7266e..746e8b63a18 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -246,7 +246,7 @@ static int map_insert_vert(PBVH *bvh, GHash *map, { void *key, **value_p; - key = SET_INT_IN_POINTER(vertex); + key = POINTER_FROM_INT(vertex); if (!BLI_ghash_ensure_p(map, key, &value_p)) { int value_i; if (BLI_BITMAP_TEST(bvh->vert_bitmap, vertex) == 0) { @@ -258,11 +258,11 @@ static int map_insert_vert(PBVH *bvh, GHash *map, value_i = ~(*face_verts); (*face_verts)++; } - *value_p = SET_INT_IN_POINTER(value_i); + *value_p = POINTER_FROM_INT(value_i); return value_i; } else { - return GET_INT_FROM_POINTER(*value_p); + return POINTER_AS_INT(*value_p); } } @@ -303,13 +303,13 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) GHashIterator gh_iter; GHASH_ITER (gh_iter, map) { void *value = BLI_ghashIterator_getValue(&gh_iter); - int ndx = GET_INT_FROM_POINTER(value); + int ndx = POINTER_AS_INT(value); if (ndx < 0) ndx = -ndx + node->uniq_verts - 1; vert_indices[ndx] = - GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); + POINTER_AS_INT(BLI_ghashIterator_getKey(&gh_iter)); } for (int i = 0; i < totface; ++i) { @@ -915,7 +915,7 @@ static void BKE_pbvh_search_callback_occluded(PBVH *bvh, static bool update_search_cb(PBVHNode *node, void *data_v) { - int flag = GET_INT_FROM_POINTER(data_v); + int flag = POINTER_AS_INT(data_v); if (node->flag & PBVH_Leaf) return (node->flag & flag) != 0; @@ -1232,7 +1232,7 @@ void BKE_pbvh_update(PBVH *bvh, int flag, float (*fnors)[3]) PBVHNode **nodes; int totnode; - BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag), + BKE_pbvh_search_gather(bvh, update_search_cb, POINTER_FROM_INT(flag), &nodes, &totnode); if (flag & PBVH_UpdateNormals) @@ -2122,7 +2122,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*fnors)[3], pbvh_node_check_mask_changed(bvh, &bvh->nodes[a]); } - BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers), + BKE_pbvh_search_gather(bvh, update_search_cb, POINTER_FROM_INT(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers), &nodes, &totnode); pbvh_update_normals(bvh, nodes, totnode, fnors); -- cgit v1.2.3