[FFmpeg-cvslog] ffplay: compact expression in compute_mod()

Stefano Sabatini git at videolan.org
Tue Apr 12 01:45:20 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Sun May  2 22:23:48 2010 +0200| [91b27e49d66b98d894506e653cbd5272fd776108] | committer: Stefano Sabatini

ffplay: compact expression in compute_mod()

Prefer "return X ? Y : Z" over "if (x) return Y; else return Z",
reduce line count.

Signed-off-by: Stefano Sabatini <stefano.sabatini-lala at poste.it>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=91b27e49d66b98d894506e653cbd5272fd776108
---

 ffplay.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index 04e0343..4b6fe8b 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -771,11 +771,7 @@ static void video_image_display(VideoState *is)
 
 static inline int compute_mod(int a, int b)
 {
-    a = a % b;
-    if (a >= 0)
-        return a;
-    else
-        return a + b;
+    return a < 0 ? a%b + b : a%b;
 }
 
 static void video_audio_display(VideoState *s)



More information about the ffmpeg-cvslog mailing list