I was starting at the assembly from some of the Python source, and
came across this (simplified) comparison:

if (x > 2305843009213693951) {...}

This is the same as:

if (x > 0x1fffffffffffffff) {...}

This is equivalent to:

if (x >> 61) {...}

More generally, we can rewrite

if ( x > ((1 << z) -1)) { ...}

as

if ( x >> z ) { ... }

This does not appear to currently be a gcc optimization.  What is
involved in adding it?

Jason

Reply via email to