[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <496F4919.8060302@draigBrady.com>
Date: Thu, 15 Jan 2009 14:32:57 +0000
From: Pádraig Brady <P@...igBrady.com>
To: Rob Landley <rob@...dley.net>
CC: "H. Peter Anvin" <hpa@...or.com>,
Leon Woestenberg <leon.woestenberg@...il.com>,
Embedded Linux mailing list <linux-embedded@...r.kernel.org>,
linux-kernel@...r.kernel.org, Sam Ravnborg <sam@...nborg.org>,
austin-group-l@...ngroup.org
Subject: Re: PATCH [0/3]: Simplify the kernel build by removing perl.
Rob Landley wrote:
> Implementing something by hand isn't _always_ a good alternative, sure. That
> would be the "thinking about the problem" part. In this instance, avoiding
> overflow is trivial. (If 1<<-1 didn't wrap around, it wouldn't even need the
> if statement.)
I don't think this affects your script but it's worth noting
that both bash and ksh use arithmetic rather than logical shift
for the >> operator.
Now arithmetic shift is not useful on 2's compliment machines,
and moreover it's compiler dependent as to whether arithmetic
or logical shift is done for >>. Therefore to increase usefulness
and decrease ambiguity, shells really should only shift unsigned
variables internally.
I know the opengroup spec says to use signed ints, but I think
that is intended to disambiguate input and output, rather than defining
internal operations. This is correct I think since the POSIX spec says
you can even use floating point internally if you like.
I asked the bash maintainer who said he would need clarification
from the austin group (CC'd) before changing anything.
cheers,
Pádraig.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists