diff --git a/MdeModulePkg/Core/Dxe/Event.h b/MdeModulePkg/Core/Dxe/Event.h index a3b0d67ff7..1709290a9f 100644 --- a/MdeModulePkg/Core/Dxe/Event.h +++ b/MdeModulePkg/Core/Dxe/Event.h @@ -84,20 +84,6 @@ CoreDispatchEventNotifies ( -/** - Return the highest set bit. - - @param Number The value to check - - @return Bit position of the highest set bit - -**/ -UINTN -CoreHighestSetBit ( - IN UINTN Number - ); - - // // Exported functions // diff --git a/MdeModulePkg/Core/Dxe/Event/Tpl.c b/MdeModulePkg/Core/Dxe/Event/Tpl.c index 5eb4628cb1..43bc8add36 100644 --- a/MdeModulePkg/Core/Dxe/Event/Tpl.c +++ b/MdeModulePkg/Core/Dxe/Event/Tpl.c @@ -35,35 +35,6 @@ CoreSetInterruptState ( } } -// -// Return the highest set bit -// - -/** - Return the highest set bit. - - @param Number The value to check - - @return Bit position of the highest set bit - -**/ -UINTN -CoreHighestSetBit ( - IN UINTN Number - ) -{ - UINTN Msb; - - Msb = 31; - while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) { - Msb--; - } - - return Msb; -} - - - /** Raise the task priority level to the new level. @@ -135,9 +106,8 @@ CoreRestoreTpl ( // // Dispatch any pending events // - - while ((-2 << NewTpl) & gEventPending) { - gEfiCurrentTpl = CoreHighestSetBit (gEventPending); + while (((-2 << NewTpl) & gEventPending) != 0) { + gEfiCurrentTpl = HighBitSet64 (gEventPending); if (gEfiCurrentTpl < TPL_HIGH_LEVEL) { CoreSetInterruptState (TRUE); }