]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: VirtioScsiDxe: drop 64-bit shift in PopulateRequest() (VS2010)
authorScott Duplichan <scott@notabs.org>
Fri, 14 Nov 2014 10:24:08 +0000 (10:24 +0000)
committerlersek <lersek@Edk2>
Fri, 14 Nov 2014 10:24:08 +0000 (10:24 +0000)
"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>
Build-tested-by: Scott Duplichan <scott@notabs.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16386 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/VirtioScsiDxe/VirtioScsi.c

index 6b8ea601cd7f786c2741eb6e74f8a35cc5067e3b..2cb3f43bb01c25c29297f0e7027d11dcd5391b8d 100644 (file)
@@ -253,7 +253,7 @@ PopulateRequest (
   //\r
   Request->Lun[0] = 1;\r
   Request->Lun[1] = (UINT8) Target;\r
   //\r
   Request->Lun[0] = 1;\r
   Request->Lun[1] = (UINT8) Target;\r
-  Request->Lun[2] = (UINT8) ((Lun >> 8) | 0x40);\r
+  Request->Lun[2] = (UINT8) (((UINT32)Lun >> 8) | 0x40);\r
   Request->Lun[3] = (UINT8) Lun;\r
 \r
   //\r
   Request->Lun[3] = (UINT8) Lun;\r
 \r
   //\r