]>
Commit | Line | Data |
---|---|---|
dfa88585 DM |
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 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
7 | This program and the accompanying materials are licensed and made available\r | |
8 | under the terms and conditions of the BSD License which accompanies this\r | |
9 | 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 signed value right by a particular number of bits.\r | |
20 | */\r | |
21 | __declspec(naked) void __cdecl _allshr (void)\r | |
22 | {\r | |
23 | _asm {\r | |
24 | ;\r | |
25 | ; Handle shifts of 64 bits or more (if shifting 64 bits or more, the result\r | |
26 | ; depends only on the high order bit of edx).\r | |
27 | ;\r | |
28 | cmp cl,64\r | |
29 | jae short SIGNRETURN\r | |
30 | \r | |
31 | ;\r | |
32 | ; Handle shifts of between 0 and 31 bits\r | |
33 | ;\r | |
34 | cmp cl, 32\r | |
35 | jae short MORE32\r | |
36 | shrd eax,edx,cl\r | |
37 | sar edx,cl\r | |
38 | ret\r | |
39 | \r | |
40 | ;\r | |
41 | ; Handle shifts of between 32 and 63 bits\r | |
42 | ;\r | |
43 | MORE32:\r | |
44 | mov eax,edx\r | |
45 | sar edx,31\r | |
46 | and cl,31\r | |
47 | sar eax,cl\r | |
48 | ret\r | |
49 | \r | |
50 | ;\r | |
51 | ; Return double precision 0 or -1, depending on the sign of edx\r | |
52 | ;\r | |
53 | SIGNRETURN:\r | |
54 | sar edx,31\r | |
55 | mov eax,edx\r | |
56 | ret\r | |
57 | }\r | |
58 | }\r |