]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm
CryptoPkg IntrinsicLib: Add the missing nasm source file
[mirror_edk2.git] / CryptoPkg / Library / IntrinsicLib / Ia32 / MathRShiftU64.nasm
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm
new file mode 100644 (file)
index 0000000..9bf1711
--- /dev/null
@@ -0,0 +1,49 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+; This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php.\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   MathRShiftU64.nasm\r
+;\r
+; Abstract:\r
+;\r
+;   64-bit Math Worker Function.\r
+;   Shifts a 64-bit unsigned value right by a certain number of bits.\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    SECTION .text\r
+\r
+;------------------------------------------------------------------------------\r
+;\r
+; void __cdecl __ashrdi3 (void)\r
+;\r
+;------------------------------------------------------------------------------\r
+global ASM_PFX(__ashrdi3)\r
+ASM_PFX(__ashrdi3):\r
+    cmp cl,0x40\r
+    jnc _Exit\r
+    cmp cl,0x20\r
+    jnc More32\r
+    shrd eax,edx,cl\r
+    shr edx,cl\r
+    ret\r
+More32:\r
+    mov eax,edx\r
+    xor edx,edx\r
+    and cl,0x1f\r
+    shr eax,cl\r
+    ret\r
+_Exit:\r
+    xor eax,eax\r
+    xor edx,edx\r
+    ret\r
+\r