From 74b0f23a3aca3c0dedd09a3143afc1141f37d1fd Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 23 Apr 1996 16:02:54 +0000 Subject: (read_disk_entry): New macro. --- ufs/ufs.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ufs/ufs.h b/ufs/ufs.h index 68a5dece..ba778e1d 100644 --- a/ufs/ufs.h +++ b/ufs/ufs.h @@ -186,6 +186,21 @@ swab_long (long arg) | ((arg & 0xff0000) >> 8) | ((arg & 0xff000000) >> 24)); } + +/* Return *ENTRYP, after byteswapping it if necessary */ +#define read_disk_entry(entryp) \ +({ \ + if (!swab_disk || sizeof (*entryp) == 1) \ + *entryp; \ + else if (sizeof (*entryp) == 2) \ + swab_short (*entryp); \ + else if (sizeof (*entry) == 4) \ + swab_long (*entryp); \ + else \ + abort; \ +}) + + -- cgit v1.2.3