diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-10-24 04:54:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-10-24 04:54:26 +0300 |
commit | db69deea898e5952bc8f510fa667c995f484a868 (patch) | |
tree | 303021f68fd11c0dc006d81fd627e116a3149641 | |
parent | 86dbbd156fafccea7bfcf3207c8486fb2098b341 (diff) |
BMesh: inline index lookups
For release builds this is now the same as indexing the array directly.
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 22 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.h | 21 |
2 files changed, 18 insertions, 25 deletions
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); |