[FFmpeg-devel] avcodec/mathops: make zero_extend() an alias of av_mod_uintp2()

Submitted by James Almer on Feb. 28, 2017, 2:44 a.m.

Details

Message ID 20170228024439.3484-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Feb. 28, 2017, 2:44 a.m.
They both do the same thing, but the latter has arch optimized implementations.

Signed-off-by: James Almer <jamrial@gmail.com>
---
Alternatively, i could duplicate the optimizations from av_mod_uintp2()
for zero_extend() in libavcodec/{arch}/mathops.h since the c versions
differ between the two.

 libavcodec/mathops.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 2cc8963a98..ddaea57da8 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -146,10 +146,7 @@  static inline av_const int sign_extend(int val, unsigned bits)
 #endif
 
 #ifndef zero_extend
-static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
-{
-    return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
-}
+#define zero_extend av_mod_uintp2
 #endif
 
 #ifndef COPY3_IF_LT