| 887 | } |
| 888 | |
| 889 | UINT8 |
| 890 | GetFileState ( |
| 891 | IN BOOLEAN ErasePolarity, |
| 892 | IN EFI_FFS_FILE_HEADER *FfsHeader |
| 893 | ) |
| 894 | /*++ |
| 895 | |
| 896 | Routine Description: |
| 897 | |
| 898 | This function returns a the highest state bit in the FFS that is set. |
| 899 | It in no way validate the FFS file. |
| 900 | |
| 901 | Arguments: |
| 902 | |
| 903 | ErasePolarity The erase polarity for the file state bits. |
| 904 | FfsHeader Pointer to a FFS file. |
| 905 | |
| 906 | Returns: |
| 907 | |
| 908 | UINT8 The hightest set state of the file. |
| 909 | |
| 910 | --*/ |
| 911 | { |
| 912 | UINT8 FileState; |
| 913 | UINT8 HighestBit; |
| 914 | |
| 915 | FileState = FfsHeader->State; |
| 916 | |
| 917 | if (ErasePolarity) { |
| 918 | FileState = (UINT8)~FileState; |
| 919 | } |
| 920 | |
| 921 | HighestBit = 0x80; |
| 922 | while (HighestBit != 0 && (HighestBit & FileState) == 0) { |
| 923 | HighestBit >>= 1; |
| 924 | } |
| 925 | |
| 926 | return HighestBit; |
| 927 | } |