Add an "EXTRACT_64BITS()" macro - using the "EXTRACT_32BITS()" macro, so

we get the fast implementations if we are on a processor that doesn't
require alignment.
This commit is contained in:
guy 2004-09-24 18:21:25 +00:00
parent 3be7baca5e
commit abad30540b
2 changed files with 7 additions and 3 deletions

View File

@ -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))

View 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);