Did I find the right examples for you? yes no

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)

src/s/y/Sypy-HEAD/jit/metainterp/optimizeopt/rewrite.py   Sypy(Download)
from pypy.jit.metainterp.resoperation import (opboolinvers, opboolreflex, rop,
    ResOperation)
from pypy.rlib.rarithmetic import highest_bit
 
 
                    # x & (x - 1) == 0 is a quick test for power of 2
                    if x & (x - 1) == 0:
                        new_rhs = ConstInt(highest_bit(lhs.box.getint()))
                        op = op.copy_and_change(rop.INT_LSHIFT, args=[rhs.box, new_rhs])
                        break
            if val & (val - 1) == 0 and val > 0: # val == 2**shift
                op = op.copy_and_change(rop.INT_RSHIFT,
                                        args = [op.getarg(0), ConstInt(highest_bit(val))])
        self.emit_operation(op)