lkml.org 
[lkml]   [2015]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] lib/zlib_inflate:change REVERSE() macro
Date
This patch change REVERSE() macro to use swab32() function,
so that can have more better performance on some platforms.

Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
lib/zlib_inflate/inflate.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/zlib_inflate/inflate.c b/lib/zlib_inflate/inflate.c
index 58a733b..f2b68b6 100644
--- a/lib/zlib_inflate/inflate.c
+++ b/lib/zlib_inflate/inflate.c
@@ -10,6 +10,7 @@
*/

#include <linux/zutil.h>
+#include <linux/swab.h>
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
@@ -228,10 +229,7 @@ static int zlib_inflateSyncPacket(z_streamp strm)
} while (0)

/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
+#define REVERSE(q) swab32(q)
/*
inflate() uses a state machine to process as much input data and generate as
much output data as possible before returning. The state machine is
--
1.9.1


\
 
 \ /
  Last update: 2015-08-10 18:41    [W:0.022 / U:1.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site