diff mbox

[edk2,v2,5/7] OvmfPkg: VirtioScsiDxe: drop 64-bit shift in PopulateRequest() (VS2010)

Message ID 1415877385-18341-6-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek Nov. 13, 2014, 11:16 a.m. UTC
From: Scott Duplichan <scott@notabs.org>

"Lun" has type UINT64 in this function. The result of the expression

  (UINT8) ((Lun >> 8) | 0x40)

depends only on bits [15:8] of "Lun", therefore we can cast "Lun" to
UINT32 before shifting it.

This eliminates an intrinsic when building with VS2010 for Ia32 / NOOPT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <scott@notabs.org>
[lersek@redhat.com: added commit message]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index 6b8ea60..2cb3f43 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -253,7 +253,7 @@  PopulateRequest (
   //
   Request->Lun[0] = 1;
   Request->Lun[1] = (UINT8) Target;
-  Request->Lun[2] = (UINT8) ((Lun >> 8) | 0x40);
+  Request->Lun[2] = (UINT8) (((UINT32)Lun >> 8) | 0x40);
   Request->Lun[3] = (UINT8) Lun;
 
   //