On Wed, Dec 19, 2007 at 03:54:55PM -0800, Tom Eastep wrote:
> Tom Eastep wrote:
> 
> > 172.16.0.0 decodes to 0x100000. Does BusyBox on that architecture only
> > support 20-bit arithmatic?
> 
> What spelling -- and I hold an advanced degree in Mathematics :-(

And perhaps more significantly, it decodes to 0xac100000.


As for the problem itself:

Shell arithmetic was never guaranteed on large numbers, it's mostly
intended for loop counters and the like. You're expected to use dc for
this kind of thing, so I suggest you do that.

Here's a dc expression for arbitrary-precision bitwise and, if you need it:

7sa 5sb 1st 0sr [La2~sxsa lb2%Lx*lt*Lr+sr Lb2/sb Lt2*st lalb*0!=l]dslx Lrp

Where 7 and 5 are the operands, and the result is on stdout. I know,
dc's ugly, but it's the only thing busybox implements, and most of the
other stuff is much neater.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to