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

Re: left_shift problem

Thread Previous | Thread Next
Yitzchak Scott-Thoennes
March 23, 2008 17:39
Re: left_shift problem
Message ID:
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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About