]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/h8300/lib/ashrdi3.c
b43: Fix memory leaks in b43_bus_dev_ssb_init and b43_bus_dev_bcma_init
[mirror_ubuntu-bionic-kernel.git] / arch / h8300 / lib / ashrdi3.c
CommitLineData
a71a29de
YS
1#include "libgcc.h"
2
3DWtype __ashrdi3(DWtype u, word_type b)
4{
5 const DWunion uu = {.ll = u};
6 const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
7 DWunion w;
8
9 if (b == 0)
10 return u;
11
12 if (bm <= 0) {
13 /* w.s.high = 1..1 or 0..0 */
14 w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1);
15 w.s.low = uu.s.high >> -bm;
16 } else {
17 const UWtype carries = (UWtype) uu.s.high << bm;
18
19 w.s.high = uu.s.high >> b;
20 w.s.low = ((UWtype) uu.s.low >> b) | carries;
21 }
22
23 return w.ll;
24}