[PATCH] lib/zlib_inflate:change REVERSE() macro
From: yalin wang
Date: Mon Aug 10 2015 - 12:15:14 EST
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@xxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/