Browse code

fix ?e16_to_host macros

git-svn: trunk@1992

Tomasz Kojm authored on 2006/05/27 23:24:40
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat May 27 16:23:43 CEST 2006 (tk)
2
+----------------------------------
3
+  * libclamav/others.h: ?e16_to_host macros were promoting 16-bit values to 24
4
+			Patch by Andy Fiddaman <clam*fiddaman.net>
5
+
1 6
 Sat May 27 13:50:42 CEST 2006 (tk)
2 7
 ----------------------------------
3 8
   * libclamav/scanners.c: fix logic bug in new code
... ...
@@ -70,7 +70,7 @@ typedef struct {
70 70
 #define le16_to_host(v)	(v)
71 71
 #define le32_to_host(v)	(v)
72 72
 #define le64_to_host(v)	(v)
73
-#define	be16_to_host(v)	((v >> 8) | (v << 8))
73
+#define	be16_to_host(v)	((v >> 8) | (v & 0xFF << 8))
74 74
 #define	be32_to_host(v)	((v >> 24) | ((v & 0x00FF0000) >> 8) | \
75 75
 				((v & 0x0000FF00) << 8) | (v << 24))
76 76
 #define be64_to_host(v)	((v >> 56) | ((v & 0x00FF000000000000LL) >> 40) | \
... ...
@@ -81,7 +81,7 @@ typedef struct {
81 81
 				((v & 0x000000000000FF00LL) << 40) | \
82 82
 				(v << 56))
83 83
 #else
84
-#define	le16_to_host(v)	((v >> 8) | (v << 8))
84
+#define	le16_to_host(v)	((v >> 8) | (v & 0xFF << 8))
85 85
 #define	le32_to_host(v)	((v >> 24) | ((v & 0x00FF0000) >> 8) | \
86 86
 				((v & 0x0000FF00) << 8) | (v << 24))
87 87
 #define le64_to_host(v)	((v >> 56) | ((v & 0x00FF000000000000LL) >> 40) | \