]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.asm
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / Ia32 / GetPowerOfTwo.asm
CommitLineData
478db76b 1;/*++\r
2;\r
4ea9375a
HT
3;Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4;This program and the accompanying materials \r
478db76b 5;are licensed and made available under the terms and conditions of the BSD License \r
6;which accompanies this distribution. The full text of the license may be found at \r
7;http://opensource.org/licenses/bsd-license.php \r
8; \r
9;THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10;WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11;\r
12;Module Name:\r
13;\r
14; GetPowerOfTwo.c\r
15;\r
16;Abstract:\r
17;\r
18; Calculates the largest integer that is both \r
19; a power of two and less than Input\r
20;\r
21;--*/\r
22;---------------------------------------------------------------------------\r
23 .686\r
24 .model flat,C\r
25 .code\r
26\r
27;---------------------------------------------------------------------------\r
28\r
29;UINT64\r
30;GetPowerOfTwo (\r
31; IN UINT64 Input\r
32; )\r
33;/*++\r
34;\r
35;Routine Description:\r
36;\r
37; Calculates the largest integer that is both \r
38; a power of two and less than Input\r
39;\r
40;Arguments:\r
41;\r
42; Input - value to calculate power of two\r
43;\r
44;Returns:\r
45;\r
46; the largest integer that is both a power of \r
47; two and less than Input\r
48;\r
49;--*/\r
0fb90682 50GetPowerOfTwo PROC\r
478db76b 51 xor eax, eax\r
52 mov edx, eax\r
53 mov ecx, [esp + 8] ; dword ptr Input[4]\r
54 jecxz _F\r
55 bsr ecx, ecx\r
56 bts edx, ecx\r
57 jmp _Exit\r
58_F:\r
59 mov ecx, [esp + 4] ; dword ptr Input[0]\r
60 jecxz _Exit\r
61 bsr ecx, ecx\r
62 bts eax, ecx\r
63_Exit:\r
64\r
65 ret\r
0fb90682 66GetPowerOfTwo ENDP\r
478db76b 67 END\r