VirtualBox

source: vbox/trunk/src/VBox/Runtime/win64/ASMMultU64ByU32DivByU32.asm@ 5015

Last change on this file since 5015 was 4071, checked in by vboxsync, 18 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

File size: 1.7 KB
Line 
1;; @file
2; innotek Portable Runtime - ASMMultU64ByU32DivByU32().
3;
4
5;
6; Copyright (C) 2006-2007 innotek GmbH
7;
8; This file is part of VirtualBox Open Source Edition (OSE), as
9; available from http://www.virtualbox.org. This file is free software;
10; you can redistribute it and/or modify it under the terms of the GNU
11; General Public License as published by the Free Software Foundation,
12; in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13; distribution. VirtualBox OSE is distributed in the hope that it will
14; be useful, but WITHOUT ANY WARRANTY of any kind.
15
16;*******************************************************************************
17;* Header Files *
18;*******************************************************************************
19%include "iprt/asmdefs.mac"
20
21BEGINCODE
22
23;;
24; Multiple a 64-bit by a 32-bit integer and divide the result by a 32-bit integer
25; using a 96 bit intermediate result.
26;
27; @returns (u64A * u32B) / u32C. (rax)
28; @param u64A rcx The 64-bit value.
29; @param u32B edx The 32-bit value to multiple by A.
30; @param u32C r8d The 32-bit value to divide A*B by.
31;
32BEGINPROC_EXPORTED ASMMultU64ByU32DivByU32
33 mov r9d, edx ; r9 = B
34 mov rax, rcx ; rax = A
35 xor edx, edx ; rdx = 0
36 mul r9 ; rax:rdx = A*B
37 mov ecx, r8d ; rcx = C (overly careful)
38 div rcx ; rax = A*B/C (rdx=reminder)
39 ret
40ENDPROC ASMMultU64ByU32DivByU32
41
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette