[FFmpeg-devel] [PATCH 1/2] avutil: Rename RSHIFT macro to ROUNDED_RSHIFT

FeRD (Frank Dana) ferdnyc at gmail.com
Mon Jan 21 19:38:59 EET 2019


libavutil/common.h contains a pair of macros on lines 54-55, which
the comment on line 53 describes as "rounded division & shift".

The division macro is named ROUNDED_DIV. The shift macro is named
RSHIFT. Since "RSHIFT" is a common name for a bitwise right-shift
operation without rounding (see e.g. FORTRAN, IBM XL C/C++), this
seems needlessly confusing.

This change renames RSHIFT to ROUNDED_RSHIFT, matching the naming
style of the ROUNDED_DIV macro.

Signed-off-by: FeRD (Frank Dana) <ferdnyc at gmail.com>
---
 libavutil/common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index 8db0291170..0bff7f8f72 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -51,7 +51,7 @@
 #endif
 
 //rounded division & shift
-#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
+#define ROUNDED_RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
 /* assume b>0 */
 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
 /* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
-- 
2.20.1



More information about the ffmpeg-devel mailing list