changeset 21418:9b66c66b16c5

11082 loader: Unexpand be32dec() Reviewed by: Gergő Doma <domag02@gmail.com> Reviewed by: Rob Johnston <rob.johnston@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
author Toomas Soome <tsoome@me.com>
date Thu, 30 May 2019 09:18:03 +0300
parents b31813fb5cdc
children 449b1c6af032
files usr/src/boot/lib/libstand/zfs/zfsimpl.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/boot/lib/libstand/zfs/zfsimpl.c	Fri May 31 15:44:56 2019 +0300
+++ b/usr/src/boot/lib/libstand/zfs/zfsimpl.c	Thu May 30 09:18:03 2019 +0300
@@ -30,6 +30,7 @@
  *	Stand-alone ZFS file reader.
  */
 
+#include <sys/endian.h>
 #include <sys/stat.h>
 #include <sys/stdint.h>
 
@@ -127,10 +128,7 @@
 static int
 xdr_int(const unsigned char **xdr, int *ip)
 {
-	*ip = ((*xdr)[0] << 24)
-		| ((*xdr)[1] << 16)
-		| ((*xdr)[2] << 8)
-		| ((*xdr)[3] << 0);
+	*ip = be32dec(*xdr);
 	(*xdr) += 4;
 	return (0);
 }
@@ -138,10 +136,7 @@
 static int
 xdr_u_int(const unsigned char **xdr, u_int *ip)
 {
-	*ip = ((*xdr)[0] << 24)
-		| ((*xdr)[1] << 16)
-		| ((*xdr)[2] << 8)
-		| ((*xdr)[3] << 0);
+	*ip = be32dec(*xdr);
 	(*xdr) += 4;
 	return (0);
 }