Indentation fix, cleanup.
[AROS.git] / arch / arm-all / arm-aeabi / lasr.c
blob7fcd5e61be7e0d3006592d600a98dec1839672ae
1 /*
2 Copyright (C) 2009-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <inttypes.h>
8 int64_t __aeabi_lasr(int64_t val, int num)
10 union {
11 int64_t v64;
12 struct {
13 uint32_t lo;
14 int32_t hi;
15 } v32;
16 } u;
18 if (num == 0)
19 return val;
21 if (num > 63)
23 if (val < 0)
24 return -1;
25 else
26 return 0;
29 u.v64 = val;
31 if (num > 31)
33 u.v32.lo = (uint32_t)(u.v32.hi >> (num - 32));
34 u.v32.hi >>= 31;
36 else
38 uint32_t reminder = ((uint32_t)u.v32.hi) << (32-num);
39 u.v32.lo = reminder | (u.v32.lo >> num);
40 u.v32.hi >>= num;
43 return u.v64;