]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/CompilerIntrinsicsLib/Arm/ashldi3.c
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 University of Illinois/NCSA
18 Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.
25 University of Illinois at Urbana-Champaign
29 Permission is hereby granted, free of charge, to any person obtaining a copy of
30 this software and associated documentation files (the "Software"), to deal with
31 the Software without restriction, including without limitation the rights to
32 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
33 of the Software, and to permit persons to whom the Software is furnished to do
34 so, subject to the following conditions:
36 * Redistributions of source code must retain the above copyright notice,
37 this list of conditions and the following disclaimers.
39 * Redistributions in binary form must reproduce the above copyright notice,
40 this list of conditions and the following disclaimers in the
41 documentation and/or other materials provided with the distribution.
43 * Neither the names of the LLVM Team, University of Illinois at
44 Urbana-Champaign, nor the names of its contributors may be used to
45 endorse or promote products derived from this Software without specific
46 prior written permission.
48 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
50 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51 CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
57 #include "Llvm_int_lib.h"
61 // Precondition: 0 <= b < bits_in_dword
64 __ashldi3(INT64 a
, INT32 b
)
66 const int bits_in_word
= (int)(sizeof(INT32
) * CHAR_BIT
);
70 if (b
& bits_in_word
) // bits_in_word <= b < bits_in_dword
73 result
.high
= input
.low
<< (b
- bits_in_word
);
75 else // 0 <= b < bits_in_word
79 result
.low
= input
.low
<< b
;
80 result
.high
= (input
.high
<< b
) | (input
.low
>> (bits_in_word
- b
));