]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/Ia32/GetPowerOfTwo.S
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EfiCommonLib / Ia32 / GetPowerOfTwo.S
CommitLineData
b341712e 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
b341712e 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#include "EfiBind.h"\r
23#---------------------------------------------------------------------------\r
24 .686: \r
25 #.MODEL flat,C\r
26 .code: \r
27\r
28#---------------------------------------------------------------------------\r
29.globl ASM_PFX(GetPowerOfTwo)\r
30#UINT64\r
31#GetPowerOfTwo (\r
32# IN UINT64 Input\r
33# )\r
34#/*++\r
35#\r
36#Routine Description:\r
37#\r
38# Calculates the largest integer that is both \r
39# a power of two and less than Input\r
40#\r
41#Arguments:\r
42#\r
43# Input - value to calculate power of two\r
44#\r
45#Returns:\r
46#\r
47# the largest integer that is both a power of \r
48# two and less than Input\r
49#\r
50#--*/\r
51ASM_PFX(GetPowerOfTwo):\r
52 xorl %eax, %eax\r
53 movl %eax, %edx\r
54 movl 8(%esp), %ecx # dword ptr Input[4]\r
55 jecxz _F\r
56 bsrl %ecx, %ecx\r
57 btsl %ecx, %edx\r
58 jmp _Exit\r
59_F: \r
60 movl 4(%esp), %ecx # dword ptr Input[0]\r
61 jecxz _Exit\r
62 bsrl %ecx, %ecx\r
63 btsl %ecx, %eax\r
64_Exit: \r
65\r
66 ret\r
67#GetPowerOfTwo ENDP\r
68\r