This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <config.h>
18
19
20 #include <gmp.h>
21
22 #include <limits.h>
23 #include <string.h>
24
25 #include "verify.h"
26
27 #include "macros.h"
28
29 #ifndef MINI_GMP_LIMB_TYPE
30
31
32 verify (GMP_NUMB_BITS == sizeof (mp_limb_t) * CHAR_BIT);
33 #endif
34
35 int
36 main ()
37 {
38 #ifndef MINI_GMP_LIMB_TYPE
39
40
41 {
42 char gmp_header_version[32];
43 sprintf (gmp_header_version, "%d.%d.%d", __GNU_MP_VERSION,
44 __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL);
45 if (strcmp (gmp_version, gmp_header_version) != 0)
46 {
47 char gmp_header_version2[32];
48 if (__GNU_MP_VERSION_PATCHLEVEL > 0
49 || (sprintf (gmp_header_version2, "%d.%d", __GNU_MP_VERSION,
50 __GNU_MP_VERSION_MINOR),
51 strcmp (gmp_version, gmp_header_version2) != 0))
52 {
53 fprintf (stderr,
54 "gmp header version (%s) does not match gmp library version (%s).\n",
55 gmp_header_version, gmp_version);
56 exit (1);
57 }
58 }
59 }
60 #endif
61
62
63 static mp_limb_t const twobody[] = { 2 };
64 static mpz_t const two = MPZ_ROINIT_N ((mp_limb_t *) twobody, 1);
65 ASSERT (mpz_fits_slong_p (two));
66 ASSERT (mpz_get_si (two) == 2);
67
68 mpz_t four;
69 mpz_init (four);
70 mpz_add (four, two, two);
71 ASSERT (mpz_fits_slong_p (four));
72 ASSERT (mpz_get_si (four) == 4);
73 mpz_clear (four);
74
75 return 0;
76 }