FreeTDS API
smp.h
1 /* Simple multiprecision - small MP library for testing
2  * Copyright (C) 2022-2024 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef freetds_utils_smp_h_
21 #define freetds_utils_smp_h_
22 
23 #include <tds_sysdep_public.h>
24 #include <freetds/bool.h>
25 
26 typedef struct {
27  uint16_t comp[8];
28 } smp;
29 
30 extern const smp smp_zero;
31 extern const smp smp_one;
32 
34 smp smp_add(smp a, smp b);
35 
37 smp smp_sub(smp a, smp b);
38 
40 smp smp_not(smp a);
41 
43 smp smp_negate(smp a);
44 
46 smp smp_from_int(int64_t n);
47 
49 bool smp_is_negative(smp a);
50 
52 bool smp_is_zero(smp a);
53 
55 int smp_cmp(smp a, smp b);
56 
58 double smp_to_double(smp a);
59 
61 char *smp_to_string(smp a);
62 
64 smp smp_from_string(const char *s);
65 
66 #endif /* freetds_utils_smp_h_ */
Definition: smp.h:26