[Top][All Lists]

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

Re: Arithmetic expression: interest in unsigned right shift?

From: Steffen Nurpmeso
Subject: Re: Arithmetic expression: interest in unsigned right shift?
Date: Mon, 18 Jul 2022 16:08:04 +0200
User-agent: s-nail v14.9.24-273-gece3a16a1a

Chet Ramey wrote in
 |On 7/16/22 1:44 PM, Steffen Nurpmeso wrote:
 |> I realized there is no unsigned right shift in bash arithmetic
 |> expression, and thought maybe there is interest.
 |Thanks. There aren't any unsigned operators in shell arithmetic now, what
 |makes this one necessary?

I came over (Basic a bit) DOS, (Pascal a bit, Microsoft Office
Basic stuff) J(ava)script, Perl to JAVA.  So ever since that (it
does only have signed operations) i take unsigned right shift with
me.  (In C and C++ i go the other way and practically work with
unsigned only, except for file offsets, monetary calculations, and
a bit.  It approaches the Sex Pistol's singer autobiography that
i never have read, "No Irish, No Blacks, No Dogs", it is just "No
Floating-point, Not much Signed, No Microsoft".  Or something.  It
comes naturally, and thus does not conflict "If it doesn't come
naturally, leave it".)

  $ mailx -#:/ -Y 'vexpr >>> -1 1; x'
  0b 01111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
  0777777777777777777777 | 0x7FFFFFFFFFFFFFFF | 9223372036854775807

  $ MXEXE -#:/ -Y 'echo $((-1 >>> 1));x'

|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]