code: func compareSeqNumbers(seqNum1, seqNum2 uint16) int {
  	// calculate distance from seqNum1 to seqNum2
  	var dist uint16
  	if seqNum1 <= seqNum2 {
  		dist = seqNum2 - seqNum1
  	} else {
  		dist = 0xffff - (seqNum1 - seqNum2 - 1)
  	}
  	if dist == 0 {
  		return 0
  	} else if dist <= 0x8000 {
  		return -1
  	}
  	return 1
  }
docs: // compareSeqNumbers returns -1, 0, 1 if sequence number <seqNum1> precedes, equals to,
  // or succeeds seq. number <seqNum2>.
  // Since sequence numbers cycle in the finite set of size 2^16, the function
  // must assume that the distance between compared sequence numbers is less than
  // (2^16)/2 to determine the order.