Skip to content

Commit 21aa44e

Browse files
bratpiorkarbanka1
authored andcommitted
add utils min/max functions
1 parent bd1c19e commit 21aa44e

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
@@ -128,3 +128,6 @@ umf_result_t utils_translate_flags(unsigned in_flags, unsigned max,
128128
*out_flags = out_f;
129129
return UMF_RESULT_SUCCESS;
130130
}
131+
132+
size_t utils_max(size_t a, size_t b) { return a > b ? a : b; }
133+
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)