def HasPackedMethodOrdinals(interface):
  """Returns whether all method ordinals are packed such that indexing into a
  table would be efficient."""
  max_ordinal = len(interface.methods) * 2
  return all(method.ordinal < max_ordinal for method in interface.methods)