summaryrefslogtreecommitdiff
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-05-31 11:25:26 +0200
committerAnton Khirnov <anton@khirnov.net>2021-06-11 19:42:47 +0200
commit580e168a945b65100ec2c25433f33bfacfe9f7be (patch)
tree411a45b685ad4815cd06e5a992719fa9387dfcd4 /libavutil/mem.h
parent71c0ef882e37091b22bae2175efb2d5cc4225d8d (diff)
downloadffmpeg-580e168a945b65100ec2c25433f33bfacfe9f7be.tar.gz
lavu/mem: un-inline av_size_mult()
There seems to be no compelling reason for it to be inline.
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r--libavutil/mem.h19
1 files changed, 1 insertions, 18 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h
index c876111afb..e9d343eaf0 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -31,7 +31,6 @@
#include <stdint.h>
#include "attributes.h"
-#include "error.h"
#include "avutil.h"
#include "version.h"
@@ -672,23 +671,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
* @param[out] r Pointer to the result of the operation
* @return 0 on success, AVERROR(EINVAL) on overflow
*/
-static inline int av_size_mult(size_t a, size_t b, size_t *r)
-{
- size_t t;
-
-#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_mul_overflow)
- if (__builtin_mul_overflow(a, b, &t))
- return AVERROR(EINVAL);
-#else
- t = a * b;
- /* Hack inspired from glibc: don't try the division if nelem and elsize
- * are both less than sqrt(SIZE_MAX). */
- if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b)
- return AVERROR(EINVAL);
-#endif
- *r = t;
- return 0;
-}
+int av_size_mult(size_t a, size_t b, size_t *r);
/**
* Set the maximum size that may be allocated in one block.