Skip to content

Commit

Permalink
add utils min/max functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bratpiorka committed Dec 12, 2024
1 parent 119dd34 commit ef970b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/utils_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ umf_result_t utils_translate_flags(unsigned in_flags, unsigned max,
*out_flags = out_f;
return UMF_RESULT_SUCCESS;
}

size_t utils_max(size_t a, size_t b) { return a > b ? a : b; }
size_t utils_min(size_t a, size_t b) { return a < b ? a : b; }
4 changes: 4 additions & 0 deletions src/utils/utils_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ int utils_fallocate(int fd, long offset, long len);

long utils_get_size_threshold(char *str_threshold);

size_t utils_max(size_t a, size_t b);

size_t utils_min(size_t a, size_t b);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit ef970b0

Please sign in to comment.