[Cython] Make positive int literals unsigned long?
Robert Bradshaw
robertwb at math.washington.edu
Fri Aug 22 10:21:31 CEST 2008
On Aug 4, 2008, at 6:50 AM, Dag Sverre Seljebotn wrote:
> If we make positive int literals unsigned long rather than plain long,
> constant-index buffer lookups are going to be optimized for free. Is
> there going to be any ill side-effects from doing this?
>
> (If not, I can always special-case int literals used for buffer
> lookups.)
As Carl Witty pointed out, arithmetic between signed an unsigned
types results in unsigned types, so (1) that means literals will
definitely not be unsigned and (2) we don't need them to be. (To get
an unsigned literal, do 1u).
- Robert
More information about the Cython-dev
mailing list