TianoCore EDK2 master
Loading...
Searching...
No Matches
MathRShiftU64.c
Go to the documentation of this file.
1
11/*
12 * Shifts a 64-bit unsigned value right by a certain number of bits.
13 */
14__declspec(naked) void __cdecl
15_aullshr (
16 void
17 )
18{
19 _asm {
20 ;
21 ; Checking: Only handle 64bit shifting or more
22 ;
23 cmp cl, 64
24 jae _Exit
25
26 ;
27 ; Handle shifting between 0 and 31 bits
28 ;
29 cmp cl, 32
30 jae More32
31 shrd eax, edx, cl
32 shr edx, cl
33 ret
34
35 ;
36 ; Handle shifting of 32-63 bits
37 ;
38More32:
39 mov eax, edx
40 xor edx, edx
41 and cl, 31
42 shr eax, cl
43 ret
44
45 ;
46 ; Invalid number (less then 32bits), return 0
47 ;
48
49_Exit:
50 xor eax, eax
51 xor edx, edx
52 ret
53 }
54}