Makefile.inc: Update 3rdparty/intel-microcode on USE_BLOBS
[coreboot.git] / src / arch / mips / ashldi3.c
blobf68d78ed60e8f2d9e4651f31ee6650e835f68877
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2014 Google, Inc.
6 * Based on linux arch/mips/lib/ashldi3.c
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #ifndef __ORDER_LITTLE_ENDIAN__
19 #errror "What endian are you!?"
20 #endif
22 typedef unsigned int word_type;
23 long long __ashldi3(long long u, word_type b);
25 struct DWstruct {
26 int low, high;
28 typedef union {
29 struct DWstruct s;
30 long long ll;
31 } DWunion;
33 long long __ashldi3(long long u, word_type b)
35 DWunion uu, w;
36 word_type bm;
38 if (b == 0)
39 return u;
41 uu.ll = u;
42 bm = 32 - b;
44 if (bm <= 0) {
45 w.s.low = 0;
46 w.s.high = (unsigned int) uu.s.low << -bm;
47 } else {
48 const unsigned int carries = (unsigned int) uu.s.low >> bm;
50 w.s.low = (unsigned int) uu.s.low << b;
51 w.s.high = ((unsigned int) uu.s.high << b) | carries;
54 return w.ll;