From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?SsO2cm4=?= Engel Subject: Re: [PATCH 1/2] Make cramfs little endian only Date: Wed, 5 Dec 2007 23:41:03 +0100 Message-ID: <20071205224102.GA32330@lazybastard.org> References: <200712041259.52118.lists-receive@programmierforen.de> <4755DB9D.3020304@garzik.org> <200712052257.43061.lists-receive@programmierforen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Andi Drebes , Jeff Garzik , J?rn Engel , linux-fsdevel@vger.kernel.org, Karel Zak , Andrew Morton , Christoph Hellwig , Phillip Lougher To: Linus Torvalds Return-path: Received: from lazybastard.de ([212.112.238.170]:40288 "EHLO longford.lazybastard.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752648AbXLEWqd (ORCPT ); Wed, 5 Dec 2007 17:46:33 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 5 December 2007 14:21:02 -0800, Linus Torvalds wrote: >=20 > No, no, what I meant about not having any #ifdef __LITTLE_ENDIAN was = to do=20 > the code do the same thing *regardless* of endianness. In other words= , a=20 > simple: >=20 > struct cramfs_inode { > __le32 mode_uid; /* CRAMFS_MODE_WIDTH:CRAMFS_UID_WIDTH */ > __le32 size_gid; /* CRAMFS_SIZE_WIDTH:CRAMFS_GID_WIDTH */ > __le32 namelen_offset; /* CRAMFS_NAMELEN_WIDTH:CRAMFS_OFFSET_WIDTH = */ > }; Mode and uid are both 16bit. So maybe we can change the structure: struct cramfs_inode { __le16 uid; __le16 mode; __le32 size_gid; /* CRAMFS_SIZE_WIDTH:CRAMFS_GID_WIDTH */ __le32 namelen_offset; /* CRAMFS_NAMELEN_WIDTH:CRAMFS_OFFSET_WIDTH */ }; That way masks and shifts are only needed for the remaining two shared variables. > (No, the above is not tested in any way, shape, or form, and no, I di= dn't=20 > double-check that I actually extracted the right bits, but you get th= e=20 > idea). Same warning applies to my code as well. J=C3=B6rn --=20 Rules of Optimization: Rule 1: Don't do it. Rule 2 (for experts only): Don't do it yet. -- M.A. Jackson - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html