File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 4
4
5
5
#include <assert.h>
6
6
7
+ size_t mushbounds_size (const mushbounds * bounds ) {
8
+ size_t sz = 1 ;
9
+ for (mushdim i = 0 ; i < MUSHSPACE_DIM ; ++ i )
10
+ sz *= bounds -> end .v [i ] - bounds -> beg .v [i ] + 1 ;
11
+ return sz ;
12
+ }
7
13
size_t mushbounds_clamped_size (const mushbounds * bounds ) {
8
14
size_t sz = mush_size_t_add_clamped (bounds -> end .v [0 ] - bounds -> beg .v [0 ], 1 );
9
15
for (mushdim i = 1 ; i < MUSHSPACE_DIM ; ++ i )
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ typedef struct mushbounds {
15
15
16
16
MUSH_DECL_CONST_DYN_ARRAY (mushbounds )
17
17
18
+ #define mushbounds_size MUSHSPACE_CAT(mushbounds,_size)
18
19
#define mushbounds_clamped_size MUSHSPACE_CAT(mushbounds,_clamped_size)
19
20
#define mushbounds_contains MUSHSPACE_CAT(mushbounds,_contains)
20
21
#define mushbounds_safe_contains MUSHSPACE_CAT(mushbounds,_safe_contains)
@@ -28,6 +29,7 @@ MUSH_DECL_CONST_DYN_ARRAY(mushbounds)
28
29
#define mushbounds_can_fuse MUSHSPACE_CAT(mushbounds,_can_fuse)
29
30
#define mushbounds_tessellate MUSHSPACE_CAT(mushbounds,_tessellate)
30
31
32
+ size_t mushbounds_size (const mushbounds * );
31
33
size_t mushbounds_clamped_size (const mushbounds * );
32
34
33
35
// The safe versions work even if the bounds have beg > end.
You can’t perform that action at this time.
0 commit comments