-
Notifications
You must be signed in to change notification settings - Fork 8
/
math128.h
48 lines (43 loc) · 2.18 KB
/
math128.h
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
/********************************************************************
* qofmath128.h -- an 128-bit integer library *
* Copyright (C) 2004 Linas Vepstas <[email protected]> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA [email protected] *
* *
*******************************************************************/
#ifndef QOF_MATH_128_H
#define QOF_MATH_128_H
typedef struct
{
uint64_t hi;
uint64_t lo;
short isneg;
short isbig;
} qofint128;
extern unsigned equal128 (qofint128 a, qofint128 b);
extern int cmp128 (qofint128 a, qofint128 b);
extern qofint128 shift128 (qofint128 x);
extern qofint128 shiftleft128 (qofint128 x);
extern qofint128 inc128 (qofint128 a);
extern qofint128 add128 (qofint128 a, qofint128 b);
extern qofint128 mult128 (int64_t a, int64_t b);
extern qofint128 div128 (qofint128 n, int64_t d);
extern int64_t rem128 (qofint128 n, int64_t d);
extern uint64_t gcf64(uint64_t num, uint64_t denom);
extern qofint128 lcm128 (uint64_t a, uint64_t b);
#endif