Skip to content

Commit 787c614

Browse files
authored
Merge pull request #549 from czurnieden/mp_31bit
made MP_31BIT working
2 parents 2c4ce7a + 13e6baf commit 787c614

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

demo/test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ static int test_mp_hash(void)
180180
0xabae35c7872c107d,
181181
0xfec74888bcef5fcd,
182182
0x27ba96030abceda5
183+
#elif (MP_DIGIT_BIT == 31)
184+
0xaf63bd4c8601b7df,
185+
0xec1be1c4749a7b86,
186+
0x138ac13639116f2e,
187+
0xdd317b32ac9dd90f,
188+
0x6f87eaac03140738
183189
#else
184190
0xaf63bd4c8601b7df,
185191
0x7e868fbf541faf44,

tommath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extern "C" {
5555
#if defined(MP_16BIT)
5656
typedef uint16_t mp_digit;
5757
# define MP_DIGIT_BIT 15
58-
#elif defined(MP_64BIT)
58+
#elif ((defined (MP_64BIT)) && !(defined(MP_31BIT)) )
5959
typedef uint64_t mp_digit;
6060
# define MP_DIGIT_BIT 60
6161
#else

tommath_private.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern void MP_FREE(void *mem, size_t size);
136136
#if defined(MP_16BIT)
137137
typedef uint32_t mp_word;
138138
#define MP_WORD_SIZE 4
139-
#elif defined(MP_64BIT)
139+
#elif ((defined (MP_64BIT)) && !(defined(MP_31BIT)) )
140140
typedef unsigned long mp_word __attribute__((mode(TI)));
141141
#define MP_WORD_SIZE 16
142142
#else
@@ -229,9 +229,6 @@ MP_PRIVATE mp_err s_mp_radix_size_overestimate(const mp_int *a, const int radix,
229229
MP_PRIVATE mp_err s_mp_fp_log(const mp_int *a, mp_int *c) MP_WUR;
230230
MP_PRIVATE mp_err s_mp_fp_log_d(const mp_int *a, mp_word *c) MP_WUR;
231231

232-
233-
234-
235232
#define MP_RADIX_MAP_REVERSE_SIZE 80u
236233
extern MP_PRIVATE const char s_mp_radix_map[];
237234
extern MP_PRIVATE const uint8_t s_mp_radix_map_reverse[];

0 commit comments

Comments
 (0)