def mod_signed_bitmap_signed(): '''-23983 % -5 == -3''' mask=2**64-1 x = (-23983&mask,-64) res = bitmap.mod(x, -5) if bitmap.signed(res) and bitmap.value(res) == -3: raise Success
def set_bitmap_signed(): result = bitmap.new(0, -32) freeslot = 0 count = 3 result = bitmap.set(result, freeslot, 1, count) if bitmap.value(result) == 7: raise Success
def mod_signed_bitmap_unsigned(): '''-23983 % -5 == 2''' mask=2**64-1 x = (-23983&mask,64) res = bitmap.mod(x, -5) if bitmap.value(res) == 0xfffffffffffffffe: raise Success
def div_unsigned_bitmap_unsigned(): '''0x10000000 / 0x10 = 0x1000000''' x = (0x10000000, 32) res = bitmap.div(x, 0x10) if bitmap.value(res) == 0x1000000: raise Success
def div_unsigned_bitmap_unsigned(): '''0x10000000 / 0x10 = 0x1000000''' x = (0x10000000,32) res = bitmap.div(x,0x10) if bitmap.value(res) == 0x1000000: raise Success
def mod_unsigned_bitmap_signed(): '''23983 % -5 == -2''' mask = pow(2, 64) - 1 x = (23983 & mask, -64) res = bitmap.mod(x, -5) if bitmap.signed(res) and bitmap.value(res) == -2: raise Success
def mod_unsigned_bitmap_unsigned(): '''23983 % 5 == 3''' mask = pow(2, 64) - 1 x = (23983 & mask, 64) res = bitmap.mod(x, 5) if bitmap.value(res) == 3: raise Success
def mod_unsigned_bitmap_unsigned(): '''23983 % 5 == 3''' mask=2**64-1 x = (23983&mask,64) res = bitmap.mod(x, 5) if bitmap.value(res) == 3: raise Success
def grow_unsigned(): x = (5, 4) res = bitmap.grow(x, 4) if res == (5 * 2**4, 8) and bitmap.value(res) == 5 * 2**4: raise Success
def signed_sub_negative_nowrap(): x = (156, -8) res = bitmap.sub(x, 10) if res == (146, -8) and bitmap.value(res) == -110: raise Success
def signed_sub_positive_wrap(): x = (5, -8) res = bitmap.sub(x, 10) if res == (251, -8) and bitmap.value(res) == -5: raise Success
def signed_add_negative_wrap(): x = (254, -8) res = bitmap.add(x, 2) if res == (0, -8) and bitmap.value(res) == 0: raise Success
def div_signed_bitmap_unsigned(): '''-0x10/-0x10 = 1''' x = (0xfffffffffffffff0, -64) res = bitmap.div(x, -0x10) if bitmap.value(res) == 1: raise Success
def signed_sub_negative_wrap(): x = (133,-8) res = bitmap.sub(x, 10) if res == (123,-8) and bitmap.value(res) == 123: raise Success
def mul_unsigned_bitmap_signed(): x = (0x40000000,32) res = bitmap.mul(x, -4) if res == (0,32) and bitmap.value(res) == 0: raise Success
def push_bitmap_signed(): x = (15,-4) res = bitmap.push(x, (15,4)) if res == (0xff,-8) and bitmap.value(res) == -1: raise Success
def push_bitmap_unsigned(): x = (15,4) res = bitmap.push(x, (15,4)) if res == (0xff,8) and bitmap.value(res) == 255: raise Success
def shrink_signed(): x = (0xff, -8) res = bitmap.shrink(x, 4) if res == (15,-4) and bitmap.value(res) == -1: raise Success
def shrink_unsigned(): x = (0x50, 8) res = bitmap.shrink(x, 4) if res == (5,4) and bitmap.value(res) == 5: raise Success
def grow_signed(): x = (15, -4) res = bitmap.grow(x, 4) if res == (15*2**4,-8) and bitmap.value(res) == -16: raise Success
def grow_unsigned(): x = (5, 4) res = bitmap.grow(x, 4) if res == (5*2**4,8) and bitmap.value(res) == 5*2**4: raise Success
def signed_sub_positive_nowrap(): x = (10, -8) res = bitmap.sub(x, 5) if res == (5, -8) and bitmap.value(res) == 5: raise Success
def signed_add_negative_nowrap(): x = (250,-8) res = bitmap.add(x, 5) if res == (255,-8) and bitmap.value(res) == -1: raise Success
def mul_unsigned_bitmap_signed(): x = (0x40000000, 32) res = bitmap.mul(x, -4) if res == (0, 32) and bitmap.value(res) == 0: raise Success
def div_signed_bitmap_signed_1(): x = (0xffffffffffffa251, -64) res = bitmap.div(x, 0xc1) if bitmap.value(res) == -124: raise Success
def signed_sub_negative_nowrap(): x = (156,-8) res = bitmap.sub(x, 10) if res == (146,-8) and bitmap.value(res) == -110: raise Success
def div_unsigned_bitmap_signed(): '''0x10 / -0x10 = -1''' x = (0x10, -32) res = bitmap.div(x, -0x10) if bitmap.value(res) == -1: raise Success
def div_unsigned_bitmap_signed(): '''0x10 / -0x10 = -1''' x = (0x10,-32) res = bitmap.div(x,-0x10) if bitmap.value(res) == -1: raise Success
def div_signed_bitmap_signed_2(): x = (0xffffffffffff1634, -64) res = bitmap.div(x, 0xad) if bitmap.value(res) == -345: raise Success
def div_signed_bitmap_signed_1(): x = (0xffffffffffffa251,-64) res = bitmap.div(x, 0xc1) if bitmap.value(res) == -124: raise Success
def signed_add_positive_nowrap(): x = (254, -8) res = bitmap.add(x, 1) if res == (255, -8) and bitmap.value(res) == -1: raise Success
def div_signed_bitmap_signed_2(): x = (0xffffffffffff1634,-64) res = bitmap.div(x, 0xad) if bitmap.value(res) == -345: raise Success
def signed_add_negative_nowrap(): x = (250, -8) res = bitmap.add(x, 5) if res == (255, -8) and bitmap.value(res) == -1: raise Success
def div_signed_bitmap_unsigned(): '''-0x10/-0x10 = 1''' x = (0xfffffffffffffff0,-64) res = bitmap.div(x, -0x10) if bitmap.value(res) == 1: raise Success
def shrink_unsigned(): x = (0x50, 8) res = bitmap.shrink(x, 4) if res == (5, 4) and bitmap.value(res) == 5: raise Success
def signed_sub_negative_wrap(): x = (133, -8) res = bitmap.sub(x, 10) if res == (123, -8) and bitmap.value(res) == 123: raise Success
def push_bitmap_unsigned(): x = (15, 4) res = bitmap.push(x, (15, 4)) if res == (0xff, 8) and bitmap.value(res) == 255: raise Success
def grow_signed(): x = (15, -4) res = bitmap.grow(x, 4) if res == (15 * 2**4, -8) and bitmap.value(res) == -16: raise Success
def shrink_signed(): x = (0xff, -8) res = bitmap.shrink(x, 4) if res == (15, -4) and bitmap.value(res) == -1: raise Success
def push_bitmap_signed(): x = (15, -4) res = bitmap.push(x, (15, 4)) if res == (0xff, -8) and bitmap.value(res) == -1: raise Success
def signed_add_negative_wrap(): x = (254,-8) res = bitmap.add(x, 2) if res == (0,-8) and bitmap.value(res) == 0: raise Success