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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux