Exemple #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))))
Exemple #2
0
 def signed_add_negative_nowrap():
     x = (250,-8)
     res = bitmap.add(x, 5)
     if res == (255,-8) and bitmap.value(res) == -1:
         raise Success
Exemple #3
0
 def signed_add_negative_wrap():
     x = (254,-8)
     res = bitmap.add(x, 2)
     if res == (0,-8) and bitmap.value(res) == 0:
         raise Success
Exemple #4
0
 def signed_add_positive_nowrap():
     x = (254, -8)
     res = bitmap.add(x, 1)
     if res == (255, -8) and bitmap.value(res) == -1:
         raise Success
Exemple #5
0
 def signed_add_positive_wrap():
     x = (255, -8)
     res = bitmap.add(x, 1)
     if res == (0, -8) and bitmap.number(res) == 0:
         raise Success