From: Michael Niedermayer Date: Sat, 19 Aug 2006 20:55:02 +0000 (+0000) Subject: SWAP X-Git-Tag: v0.5~12082 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67eca72dc0183025397191dbf93e1e5033354afb;p=platform%2Fupstream%2Flibav.git SWAP Originally committed as revision 6030 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index a6c93c4..c7a7659 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1687,7 +1687,7 @@ void MPV_frame_end(MpegEncContext *s) * @param color color of the arrow */ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ - int t, x, y, fr, f; + int x, y, fr, f; sx= clip(sx, 0, w-1); sy= clip(sy, 0, h-1); @@ -1698,8 +1698,8 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h if(ABS(ex - sx) > ABS(ey - sy)){ if(sx > ex){ - t=sx; sx=ex; ex=t; - t=sy; sy=ey; ey=t; + SWAP(int, sx, ex); + SWAP(int, sy, ey); } buf+= sx + sy*stride; ex-= sx; @@ -1712,8 +1712,8 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h } }else{ if(sy > ey){ - t=sx; sx=ex; ex=t; - t=sy; sy=ey; ey=t; + SWAP(int, sx, ex); + SWAP(int, sy, ey); } buf+= sx + sy*stride; ey-= sy; diff --git a/libavutil/common.h b/libavutil/common.h index b0f0acf..be665a9 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -169,6 +169,8 @@ typedef uint64_t uint_fast64_t; #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define SWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) + /* misc math functions */ extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256];