/* Compare two positions in the boot script table and return their relative position.  */
RETURN_STATUS EFIAPI S3BootScriptCompare(IN UINT8 *Position1, IN UINT8 *Position2, OUT UINTN *RelativePosition)
/* Compare two positions in the boot script table and return their relative position.  */
RETURN_STATUS EFIAPI S3BootScriptCompare(IN UINT8 *Position1, IN UINT8 *Position2, OUT UINTN *RelativePosition)
{
  UINT8   *Script;
  UINT32  TableLength;
  if (!mS3BootScriptAcpiS3Enable) {
    return RETURN_SUCCESS;
  }
  if (RelativePosition == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  Script = S3BootScriptGetEntryAddAddress (0);
  if (Script == NULL) {
    return RETURN_OUT_OF_RESOURCES;
  }
  Script = mS3BootScriptTablePtr->TableBase;
  TableLength = mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE);
  if ((Position1 < Script) || (Position1 > Script+TableLength)) {
    return EFI_INVALID_PARAMETER;
  }
  if ((Position2 < Script) || (Position2 > Script+TableLength)) {
    return EFI_INVALID_PARAMETER;
  }
  *RelativePosition = (Position1 < Position2) ? -1 : ((Position1 == Position2) ? 0 : 1);
  return EFI_SUCCESS;
}