MdePkg/PciSegmentLib: Optimize PCI_SEGMENT_LIB_ADDRESS()
authorMichael Kinney <michael.d.kinney@intel.com>
Wed, 26 Oct 2016 21:08:22 +0000 (14:08 -0700)
committerMichael Kinney <michael.d.kinney@intel.com>
Fri, 28 Oct 2016 04:57:52 +0000 (21:57 -0700)
https://bugzilla.tianocore.org/show_bug.cgi?id=180

The PCI_SEGMENT_LIB_ADDRESS() macro puts the Segment number
into bits 32..47 of the logical address that is returned.
The portable method to put Segment in this bit range is to
use LShitU64().  For 64-bit CPUs, this is optimized well
by the compiler.  For 32-bit CPUs, a call to LSHiftU64()
is included in the generated binaries.  However, if the
Segment parameter is 0, then no shift is required.  Add
a check for Segment set to 0 and provide an optimized
macro implementation that does not call LShiftU64().

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

No differences found