]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | 64-bit Math Worker Function.\r | |
3 | The 32-bit versions of C compiler generate calls to library routines\r | |
4 | to handle 64-bit math. These functions use non-standard calling conventions.\r | |
5 | \r | |
6 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | \r | |
18 | /*\r | |
19 | * Shifts a 64-bit unsigned value right by a certain number of bits.\r | |
20 | */\r | |
21 | __declspec(naked) void __cdecl _aullshr (void)\r | |
22 | {\r | |
23 | _asm {\r | |
24 | ;\r | |
25 | ; Checking: Only handle 64bit shifting or more\r | |
26 | ;\r | |
27 | cmp cl, 64\r | |
28 | jae _Exit\r | |
29 | \r | |
30 | ;\r | |
31 | ; Handle shifting between 0 and 31 bits\r | |
32 | ;\r | |
33 | cmp cl, 32\r | |
34 | jae More32\r | |
35 | shrd eax, edx, cl\r | |
36 | shr edx, cl\r | |
37 | ret\r | |
38 | \r | |
39 | ;\r | |
40 | ; Handle shifting of 32-63 bits\r | |
41 | ;\r | |
42 | More32:\r | |
43 | mov eax, edx\r | |
44 | xor edx, edx\r | |
45 | and cl, 31\r | |
46 | shr eax, cl\r | |
47 | ret\r | |
48 | \r | |
49 | ;\r | |
50 | ; Invalid number (less then 32bits), return 0\r | |
51 | ;\r | |
52 | _Exit:\r | |
53 | xor eax, eax\r | |
54 | xor edx, edx\r | |
55 | ret\r | |
56 | }\r | |
57 | }\r |