]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add an "EXTRACT_64BITS()" macro - using the "EXTRACT_32BITS()" macro, so
authorguy <guy>
Fri, 24 Sep 2004 18:21:25 +0000 (18:21 +0000)
committerguy <guy>
Fri, 24 Sep 2004 18:21:25 +0000 (18:21 +0000)
we get the fast implementations if we are on a processor that doesn't
require alignment.

extract.h
print-nfs.c

index ecb03962861bea33a4479428be8151bc67e54f14..0d40ed3a19fb1b4e69cbab0a1e4a9dd5b340e19f 100644 (file)
--- a/extract.h
+++ b/extract.h
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.20 2004-09-23 21:30:12 dyoung Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.21 2004-09-24 18:21:25 guy Exp $ (LBL)
  */
 
 /* Network to host order macros */
@@ -85,6 +85,10 @@ typedef struct {
                     (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
                     (u_int32_t)*((const u_int8_t *)(p) + 2)))
 
+#define EXTRACT_64BITS(p) \
+       ((u_int64_t)(u_int64_t)(EXTRACT_32BITS((p) + 0)) << 32 | \
+                   (u_int64_t)(EXTRACT_32BITS((p) + 4)))
+
 /* Little endian protocol host order macros */
 
 #define EXTRACT_LE_8BITS(p) (*(p))
index fd70090c027b5e18c874f349c3f819eec6c857a5..4a2d1f3eab919bceff79ef742c98ee43fba9550a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.102 2004-04-17 08:56:14 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.103 2004-09-24 18:21:25 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -174,7 +174,7 @@ static int print_int64(const u_int32_t *dp, int how)
 {
        u_int64_t res;
 
-       res = ((u_int64_t)EXTRACT_32BITS(&dp[0]) << 32) | (u_int64_t)EXTRACT_32BITS(&dp[1]);
+       res = EXTRACT_64BITS((u_int8_t *)dp);
        switch (how) {
        case SIGNED:
                printf("%" PRId64, res);