summaryrefslogtreecommitdiff
path: root/firmware/lib/builtins/int_lib.h
blob: 3d968a8e5004a3aa32a8720419f6791a3e8b1df6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ===-- int_lib.h - configuration header for compiler-rt  -----------------===
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is dual licensed under the MIT and the University of Illinois Open
 * Source Licenses. See LICENSE.TXT for details.
 *
 * ===----------------------------------------------------------------------===
 *
 * This file is a configuration header for compiler-rt.
 * This file is not part of the interface of this library.
 *
 * ===----------------------------------------------------------------------===
 */

#ifndef INT_LIB_H
#define INT_LIB_H

#define CHAR_BIT 8

typedef unsigned su_int;
typedef int si_int;

typedef unsigned long long du_int;
typedef long long di_int;

typedef union
{
    di_int all;
    struct
    {
        su_int low;
        si_int high;
    } s;
} dwords;

typedef union
{
    du_int all;
    struct
    {
        su_int low;
        su_int high;
    } s;
} udwords;

/* Assumption: Signed integral is 2's complement. */
/* Assumption: Right shift of signed negative is arithmetic shift. */

di_int __divdi3(di_int a, di_int b);
di_int __moddi3(di_int a, di_int b);
du_int __umoddi3(du_int a, du_int b);
di_int __divmoddi4(di_int a, di_int b, di_int* rem);
du_int __udivmoddi4(du_int a, du_int b, du_int* rem);

#endif /* INT_LIB_H */