/* This function returns a the highest state bit in the FFS that is set. It in no way validate the FFS file. */
UINT8 GetFileState(IN BOOLEAN ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
/* This function returns a the highest state bit in the FFS that is set. It in no way validate the FFS file. */
UINT8 GetFileState(IN BOOLEAN ErasePolarity, IN EFI_FFS_FILE_HEADER *FfsHeader)
{
  UINT8 FileState;
  UINT8 HighestBit;
  FileState = FfsHeader->State;
  if (ErasePolarity) {
    FileState = (UINT8)~FileState;
  }
  HighestBit = 0x80;
  while (HighestBit != 0 && (HighestBit & FileState) == 0) {
    HighestBit >>= 1;
  }
  return HighestBit;
}