def maskshift(field):
  """return a mask and shift defined by field"""
  if len(field) == 1:
    return (1 << field[0], field[0])
  else:
    return (((1 << (field[0] - field[1] + 1)) - 1) << field[1], field[1])