Unexpand be32dec().

MFC after:	2 weeks
This commit is contained in:
delphij 2019-05-30 02:23:57 +00:00
parent ce38ee5193
commit f5d737a321

View File

@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
* Stand-alone ZFS file reader. * Stand-alone ZFS file reader.
*/ */
#include <sys/endian.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/stdint.h> #include <sys/stdint.h>
@ -128,10 +129,7 @@ zfs_free(void *ptr, size_t size)
static int static int
xdr_int(const unsigned char **xdr, int *ip) xdr_int(const unsigned char **xdr, int *ip)
{ {
*ip = ((*xdr)[0] << 24) *ip = be32dec(*xdr);
| ((*xdr)[1] << 16)
| ((*xdr)[2] << 8)
| ((*xdr)[3] << 0);
(*xdr) += 4; (*xdr) += 4;
return (0); return (0);
} }
@ -139,10 +137,7 @@ xdr_int(const unsigned char **xdr, int *ip)
static int static int
xdr_u_int(const unsigned char **xdr, u_int *ip) xdr_u_int(const unsigned char **xdr, u_int *ip)
{ {
*ip = ((*xdr)[0] << 24) *ip = be32dec(*xdr);
| ((*xdr)[1] << 16)
| ((*xdr)[2] << 8)
| ((*xdr)[3] << 0);
(*xdr) += 4; (*xdr) += 4;
return (0); return (0);
} }