Numworks Epsilon  1.4.1
Graphing Calculator Operating System
llsl.c
Go to the documentation of this file.
1 /* See the "Run-time ABI for the ARM Architecture", Section 4.2 */
2 #include <assert.h>
3 
4 typedef unsigned int uint32_t;
5 
6 long long __aeabi_llsl(long long value, int shift) {
7  uint32_t low = (uint32_t)value << shift;
8  /* "Shift behavior is undefined if the right operand is negative, or greater
9  * than or equal to the length in bits of the promoted left operand" according
10  * to C++ spec. However, arm compiler fill the vacated bits with 0 */
11  assert(shift < 32 || low == 0);
12  uint32_t high = ((uint32_t)(value >> 32) << shift);
13  // Same comment
14  assert(shift < 32 || high == 0);
15  if (shift < 32) {
16  high |= ((uint32_t)value >> (32 - shift));
17  } else {
18  high |= ((uint32_t)value << (shift - 32));
19  }
20  return ((long long)high << 32) | low;
21 }
long long __aeabi_llsl(long long value, int shift)
Definition: llsl.c:6
#define assert(e)
Definition: assert.h:9
unsigned int uint32_t
Definition: stdint.h:6
unsigned int uint32_t
Definition: llsl.c:4