Exemple #1
0
def make_F2(u, v, a, b, offset):
  assert bool(u) == u, repr(u)
  assert bool(v) == v, repr(v)
  assert 0 <= a < 0x10, repr(a)
  assert 0 <= b < 0x10, repr(b)
  assert 0 <= abs(offset) < 2**20, repr(offset)
  return bint(
    (1 << 31) + 
    (u << 29) +
    (v << 28) +
    (a << 24) +
    (b << 20) +
    signed(offset, 20)
    )
def make_F1(u, v, op, a, b, K):
  assert bool(u) == u, repr(u)
  assert bool(v) == v, repr(v)
  assert ops['Mov'] <= op <= ops['Div'], repr(op)
  assert 0 <= a < 0x10, repr(a)
  assert 0 <= b < 0x10, repr(b)
  assert 0 <= abs(K) < 2**16, repr(K)
  return bint(
    (1 << 30) + # set q
    (u << 29) +
    (v << 28) +
    (a << 24) +
    (b << 20) +
    (op << 16) +
    signed(K)
    )
Exemple #3
0
def WriteInt(r, item):
  item = int(signed(item, 32))
  val = pack('>L', item)
  r.write(val)