Skip to content

Commit 101567a

Browse files
committed
add utils min/max functions
1 parent 9f1476a commit 101567a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/utils/utils_common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,6 @@ umf_result_t utils_translate_flags(unsigned in_flags, unsigned max,
129129
*out_flags = out_f;
130130
return UMF_RESULT_SUCCESS;
131131
}
132+
133+
size_t utils_max(size_t a, size_t b) { return a > b ? a : b; }
134+
size_t utils_min(size_t a, size_t b) { return a < b ? a : b; }

src/utils/utils_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ int utils_fallocate(int fd, long offset, long len);
176176

177177
long utils_get_size_threshold(char *str_threshold);
178178

179+
size_t utils_max(size_t a, size_t b);
180+
181+
size_t utils_min(size_t a, size_t b);
182+
179183
#ifdef __cplusplus
180184
}
181185
#endif

0 commit comments

Comments
 (0)