[PATCH 3/4] environment: Add function to load envfs from buffer

Sascha Hauer s.hauer at pengutronix.de
Sat Feb 22 13:28:51 EST 2014


Hi Alex,

On Thu, Feb 20, 2014 at 04:16:05PM +0100, Alexander Aring wrote:
> Hi Sascha,
> 
> > -		printf("Open %s %s\n", filename, errno_str());
> > -		return -1;
> > +	if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
> > +		printf("envfs: wrong magic\n");
> > +		return -EIO;
> 
> In this case only on big endians machines:
> if (super->magic != ENVFS_32(ENVFS_MAGIC))
> 
> is faster than:
> if (ENVFS_32(super->magic) != ENVFS_MAGIC)
> 
> It's save (I suppose) ca. 4 instruktions... so it doesn't matter
> to change it.

You're right that it's slightly more efficient. I think that it's more
obviously correct converting the 'foreign' value to host order, so I
think I'll keep my version.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list