MPHELL  4.0.0
mphell-define.h
Go to the documentation of this file.
1 /*
2  MPHELL-4.0
3  Author(s): The MPHELL team
4 
5  (C) Copyright 2015-2018 - Institut Fourier / Univ. Grenoble Alpes (France)
6 
7  This file is part of the MPHELL Library.
8  MPHELL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, version 3 of the License.
11 
12  MPHELL is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with MPHELL. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
26 #ifndef MPHELL_DEFINE_H
27 #define MPHELL_DEFINE_H
28 
29 #include <stdint.h>
30 
31 #include "mphell-config.h"
32 
33 #if MPHELL_USE_DEBUG == 1
34 #define MPHELL_USE_ASSERT 1
35 #else
36 #define MPHELL_USE_ASSERT 0
37 #endif
38 
39 #define PROC X86_64
40 
41 #if MPHELL_HAVE_GMP == 1
42 #if MPHELL_USE_GMP == 1
43 #include <gmp.h>
44 #define INIT_SIZE_MAIN_STACK 1000
45 #define INIT_SIZE_OTHERS_STACKS 1000
46 #define BLOCK_SIZE GMP_LIMB_BITS
47 #endif
48 #endif
49 
50 #if MPHELL_HAVE_IPP == 1
51 #if MPHELL_USE_IPP == 1
52 #include <ippcp.h>
53 #define INIT_SIZE_MAIN_STACK 1000
54 #define INIT_SIZE_OTHERS_STACKS 1000
55 #define BLOCK_SIZE 32
56 #endif
57 #endif
58 
59 #if MPHELL_HAVE_MBEDTLS == 1
60 #if MPHELL_USE_MBEDTLS == 1
61 #include "mbedtls/bignum.h"
62 #include "mbedtls/bn_mul.h"
63 #define INIT_SIZE_MAIN_STACK 1000
64 #define INIT_SIZE_OTHERS_STACKS 1000
65 #if defined(MBEDTLS_HAVE_INT64)
66 #define BLOCK_SIZE 64
67 #else
68 #define BLOCK_SIZE 32
69 #endif
70 #endif
71 #endif
72 
73 #define STACK_1 1
74 #define STACK_2 2
75 
76 #define POOL_SIZE_FP 40
77 #define POOL_SIZE_FIELD 100
78 
79 #if BLOCK_SIZE == 64
80 #define UMAX (~(uint64_t)0)
81 typedef uint64_t block;
82 #else
83 #define UMAX (~(uint32_t)0)
84 typedef uint32_t block;
85 #endif
86 
87 #define BYTES_PER_LIMB (BLOCK_SIZE/8)
88 
89 #endif