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

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

 



On Sat, Feb 22, 2014 at 07:28:51PM +0100, Sascha Hauer wrote:
> 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.

thanks for your answer. Yeah, maybe I am hanging a little bit too much
on netdev mailinglist where all netdevs checks on something like this
because it's mostly in some atomic context. This need to be fast and
not beautiful in a kind of human thinking. :-)

- Alex

_______________________________________________
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