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

Re: [Xen-devel] [PATCH v3 14/14] libxl: build a device tree for ARM guests



Ian Campbell writes ("Re: [PATCH v3 14/14] libxl: build a device tree for ARM 
guests"):
> On Thu, 2013-11-07 at 17:47 +0000, Ian Jackson wrote:
> > Personally I normally do something like this
> >      fdt_size += 4096;
> >      fdt_size <<= 2;
> > which avoids the if (fdt_size).  The only downside is that the
> > answers aren't uniformly powers of 2.
> 
> TBH I could just go with += and avoid the <<=, I don't actually expect
> an FDT to be so large that exponentially increasing size is that
> important.

Bear in mind that each of these iterations dumps a bunch of garbage
into the gc.

> How would
>       for(fdt_size = 4096; fdt_size < FDT_SIZE_MAX; fdt_size <<= 2)
> and use continue on error in the macro, with a break at the bottom of
> the loop (success) sit with you?

That would be OK, but using "continue" makes the macro unsuitable to
use in a loop, which is less good.  I think it's worth a goto to make
the macro loop-safe.

If you prefer "continue" you can do "goto resize_continue" and put
resize_continue at the end of the loop.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.