diff options
author | Michael Kinney <michael.d.kinney@intel.com> | 2017-05-02 17:23:22 -0700 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-07-12 11:24:47 +0800 |
commit | 828d11638d93a3148b3c6505b6ff4d338f824792 (patch) | |
tree | a4d5bf13f7b9fee5a5d8f77e14fdf223cfa1521b /Core | |
parent | a3a1f310ad0cbd7171d566cfff32b624243a97a1 (diff) | |
download | edk2-platforms-828d11638d93a3148b3c6505b6ff4d338f824792.tar.xz |
PcAtChipsetPkg/SerialIoLib: Remove negative value shift
https://bugzilla.tianocore.org/show_bug.cgi?id=553
Remove left shift of negative values that always evaluate
to 0 to address build errors from the llvm/clang compiler
used in the XCODE5 tool chain.
Clang rightfully complains about left-shifting ~DLAB. DLAB is #defined
as 0x01 (an "int"), hence ~DLAB has value (-2) on all edk2 platforms.
Left-shifting a negative int is undefined behavior.
Rather than replacing ~DLAB with ~(UINT32)DLAB, realize that the nonzero
bits of (~(UINT32)DLAB << 7) would all be truncated away in the final
conversion to UINT8 anyway. So just remove (~DLAB << 7).
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit bbd61de5dbc6ad146dc7250e9646cb662604b5f3)
Diffstat (limited to 'Core')
-rw-r--r-- | Core/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Core/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c b/Core/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c index 95e0db70ad..0a2e20c1d9 100644 --- a/Core/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c +++ b/Core/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c @@ -102,7 +102,7 @@ SerialPortInitialize ( //
// Switch back to bank 0
//
- OutputData = (UINT8) ((~DLAB << 7) | (gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data);
+ OutputData = (UINT8) ( (gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data);
IoWrite8 (gUartBase + LCR_OFFSET, OutputData);
return RETURN_SUCCESS;
@@ -481,7 +481,7 @@ SerialPortSetAttributes ( //
// Switch back to bank 0
//
- OutputData = (UINT8) ((~DLAB << 7) | (gBreakSet << 6) | (LcrParity << 3) | (LcrStop << 2) | LcrData);
+ OutputData = (UINT8) ((gBreakSet << 6) | (LcrParity << 3) | (LcrStop << 2) | LcrData);
IoWrite8 (gUartBase + LCR_OFFSET, OutputData);
return RETURN_SUCCESS;
|