[Bf-blender-cvs] [db69deea898] master: BMesh: inline index lookups

Campbell Barton noreply at git.blender.org
Wed Oct 24 03:55:30 CEST 2018


Commit: db69deea898e5952bc8f510fa667c995f484a868
Author: Campbell Barton
Date:   Wed Oct 24 12:54:12 2018 +1100
Branches: master
https://developer.blender.org/rBdb69deea898e5952bc8f510fa667c995f484a868

BMesh: inline index lookups

For release builds this is now the same as indexing the array directly.

===================================================================

M	source/blender/bmesh/intern/bmesh_mesh.c
M	source/blender/bmesh/intern/bmesh_mesh.h

===================================================================

diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 185e5412b3d..4568c3b7965 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -1455,28 +1455,6 @@ void BM_mesh_elem_table_free(BMesh *bm, const char htype)
 	}
 }
 
-BMVert *BM_vert_at_index(BMesh *bm, const int index)
-{
-	BLI_assert((index >= 0) && (index < bm->totvert));
-	BLI_assert((bm->elem_table_dirty & BM_VERT) == 0);
-	return bm->vtable[index];
-}
-
-BMEdge *BM_edge_at_index(BMesh *bm, const int index)
-{
-	BLI_assert((index >= 0) && (index < bm->totedge));
-	BLI_assert((bm->elem_table_dirty & BM_EDGE) == 0);
-	return bm->etable[index];
-}
-
-BMFace *BM_face_at_index(BMesh *bm, const int index)
-{
-	BLI_assert((index >= 0) && (index < bm->totface));
-	BLI_assert((bm->elem_table_dirty & BM_FACE) == 0);
-	return bm->ftable[index];
-}
-
-
 BMVert *BM_vert_at_index_find(BMesh *bm, const int index)
 {
 	return BLI_mempool_findelem(bm->vpool, index);
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index d449aac04f5..9d7866c280a 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -75,9 +75,24 @@ void           BM_mesh_elem_table_ensure(BMesh *bm, const char htype);
 void           BM_mesh_elem_table_init(BMesh *bm, const char htype);
 void           BM_mesh_elem_table_free(BMesh *bm, const char htype);
 
-BMVert *BM_vert_at_index(BMesh *bm, const int index);
-BMEdge *BM_edge_at_index(BMesh *bm, const int index);
-BMFace *BM_face_at_index(BMesh *bm, const int index);
+BLI_INLINE BMVert *BM_vert_at_index(BMesh *bm, const int index)
+{
+	BLI_assert((index >= 0) && (index < bm->totvert));
+	BLI_assert((bm->elem_table_dirty & BM_VERT) == 0);
+	return bm->vtable[index];
+}
+BLI_INLINE BMEdge *BM_edge_at_index(BMesh *bm, const int index)
+{
+	BLI_assert((index >= 0) && (index < bm->totedge));
+	BLI_assert((bm->elem_table_dirty & BM_EDGE) == 0);
+	return bm->etable[index];
+}
+BLI_INLINE BMFace *BM_face_at_index(BMesh *bm, const int index)
+{
+	BLI_assert((index >= 0) && (index < bm->totface));
+	BLI_assert((bm->elem_table_dirty & BM_FACE) == 0);
+	return bm->ftable[index];
+}
 
 BMVert *BM_vert_at_index_find(BMesh *bm, const int index);
 BMEdge *BM_edge_at_index_find(BMesh *bm, const int index);



More information about the Bf-blender-cvs mailing list