Пример #1
0
    def set_bitmap_unsigned():
        x = bitmap.new(0xf000000000000000,64)
        #x = bitmap.set(x, 60, count=4)
        print bitmap.string(x)

        y,res = bitmap.shift(x, 4)
        print res,bitmap.string(y)

        x = bitmap.new(0,0)
        x = bitmap.push(x, (0x1,4) )
        x = bitmap.push(x, (0x2,4) )
        x = bitmap.push(x, (0x3,4) )
        x = bitmap.push(x, (0x4,4) )
        print x,bitmap.string(x)

        x = bitmap.new(0,0)
        x = bitmap.insert(x, (0x1,4) )
        x = bitmap.insert(x, (0x2,4) )
        x = bitmap.insert(x, (0x3,4) )
        x = bitmap.insert(x, (0x4,4) )
        print x,bitmap.string(x)

        x = bitmap.consumer('\x12\x34')
        print x.consume(4)
        print x.consume(4)
        print x.consume(4)
        print x.consume(4)

        x = bitmap.new(0, 4)
        for i in range(6):
            print x
            x = bitmap.add(x, 3)

        for i in range(6):
            print x
            x = bitmap.sub(x, 6)

        x = bitmap.new(4,4)
        print bitmap.string(bitmap.ror(bitmap.ror(bitmap.ror(x))))
Пример #2
0
 def shift_empty_bitmap():
     x = (0,0)
     res,n = bitmap.shift(x, 8)
     if n == 0 and res == (0,0):
         raise Success
Пример #3
0
 def shift_zero_bitmap_signed():
     x = (0x41424344, -32)
     res,n = bitmap.shift(x, 0)
     if n == 0 and res == (0x41424344,-32):
         raise Success
Пример #4
0
 def shift_signed_bitmap_signed():
     x = (0xff424344,-32)
     res,n = bitmap.shift(x, 8)
     if n == -1 and res == (0x424344,-24):
         raise Success
Пример #5
0
 def shift_signed_bitmap_unsigned():
     x = (0xff424344,32)
     res,n = bitmap.shift(x, 8)
     if n == 0xff and res == (0x424344,24):
         raise Success