def decodeBase40(val):
  """
  Given a value representing a base-40 number, return a list of three items
  containing the decoded base-40 number. Each ``val`` holds 3 base-40
  characters.

  Used for decoding call signs.

  Args:
    val (int): Integer holding 3 base-40 characters.

  Returns:
    list: List of 3 items, each containing the numeric value of a base-40
    number.
  """
  if val == 0:
    return [0,0,0]

  ret = []
  while val:
    ret.append(int(val % 40))
    val //= 40

  while len(ret) < 3:
    ret.append(0)  

  return ret[::-1]