develooper Front page | perl.perl5.porters | Postings from March 2008

Re: left_shift problem

Thread Previous | Thread Next
From:
Yitzchak Scott-Thoennes
Date:
March 23, 2008 17:39
Subject:
Re: left_shift problem
Message ID:
53994.71.32.84.230.1206319133.squirrel@webmail.efn.org
On Sun, March 23, 2008 5:15 pm, Reini Urban wrote:
> Yitzchak Scott-Thoennes schrieb:
>> By design, the numeric bit ops give their arguments UV context (or,
>> under use integer, IV context).  If another type of numeric arg is
>> provided, it is converted via a C cast (which doesn't quite match your
>> terms "upgraded" or "degraded") and produce a UV-range (or, under use
>> integer, IV-range) result.  Like all context application, it is
>> something imposed on the operands by the operator.
>
> Thanks! This explains it perfectly.
>
> But still, the degration detail.
> Assume UV 2^32-1 and HINT_INTEGER in the op =>
> IV not representable.
> left_shift would make it representable again, but the cast in const IV i =
> TOPi; threw it away before, before shifting.

I'm not understanding exactly what case you mean, especially the "left_shift
would make it representable again".  Unless you are thinking of right_shift?
Can you show the relevant perl code snippet and its actual and your desired
results?


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About