Skip to content

Commit 5190ae6

Browse files
authored
Merge pull request #325 from libtom/rename_mag_fn
Rename bn_get_magxx -> bn_get_mag_uxx. Documentation updated too
2 parents dad0fbd + 0db64fc commit 5190ae6

20 files changed

+87
-86
lines changed

bn_deprecated.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,19 @@ mp_err mp_set_long_long(mp_int *a, unsigned long long b)
170170
#ifdef BN_MP_GET_INT_C
171171
unsigned long mp_get_int(const mp_int *a)
172172
{
173-
return mp_get_mag32(a);
173+
return (unsigned long)mp_get_mag_u32(a);
174174
}
175175
#endif
176176
#ifdef BN_MP_GET_LONG_C
177177
unsigned long mp_get_long(const mp_int *a)
178178
{
179-
return (sizeof(long) > sizeof(int32_t)) ? (unsigned long)mp_get_mag64(a) : (unsigned long)mp_get_mag32(a);
179+
return (unsigned long)mp_get_mag_ul(a);
180180
}
181181
#endif
182182
#ifdef BN_MP_GET_LONG_LONG_C
183183
unsigned long long mp_get_long_long(const mp_int *a)
184184
{
185-
return (unsigned long long)mp_get_mag64(a);
185+
return mp_get_mag_ull(a);
186186
}
187187
#endif
188188
#ifdef BN_MP_PRIME_IS_DIVISIBLE_C

bn_mp_get_i32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_SIGNED(mp_get_i32, mp_get_mag32, int32_t, uint32_t)
6+
MP_GET_SIGNED(mp_get_i32, mp_get_mag_u32, int32_t, uint32_t)
77
#endif

bn_mp_get_i64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_SIGNED(mp_get_i64, mp_get_mag64, int64_t, uint64_t)
6+
MP_GET_SIGNED(mp_get_i64, mp_get_mag_u64, int64_t, uint64_t)
77
#endif

bn_mp_get_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_SIGNED(mp_get_l, mp_get_magl, long, unsigned long)
6+
MP_GET_SIGNED(mp_get_l, mp_get_mag_ul, long, unsigned long)
77
#endif

bn_mp_get_ll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_SIGNED(mp_get_ll, mp_get_magll, long long, unsigned long long)
6+
MP_GET_SIGNED(mp_get_ll, mp_get_mag_ull, long long, unsigned long long)
77
#endif
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "tommath_private.h"
2-
#ifdef BN_MP_GET_MAG32_C
2+
#ifdef BN_MP_GET_MAG_U32_C
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_MAG(mp_get_mag32, uint32_t)
6+
MP_GET_MAG(mp_get_mag_u32, uint32_t)
77
#endif
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "tommath_private.h"
2-
#ifdef BN_MP_GET_MAG64_C
2+
#ifdef BN_MP_GET_MAG_U64_C
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_MAG(mp_get_mag64, uint64_t)
6+
MP_GET_MAG(mp_get_mag_u64, uint64_t)
77
#endif
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "tommath_private.h"
2-
#ifdef BN_MP_GET_MAGL_C
2+
#ifdef BN_MP_GET_MAG_UL_C
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_MAG(mp_get_magl, unsigned long)
6+
MP_GET_MAG(mp_get_mag_ul, unsigned long)
77
#endif
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "tommath_private.h"
2-
#ifdef BN_MP_GET_MAGLL_C
2+
#ifdef BN_MP_GET_MAG_ULL_C
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6-
MP_GET_MAG(mp_get_magll, unsigned long long)
6+
MP_GET_MAG(mp_get_mag_ull, unsigned long long)
77
#endif

demo/test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int test_trivial_stuff(void)
9090
if (mp_get_u32(&b) != (uint32_t)-4) {
9191
goto LBL_ERR;
9292
}
93-
if (mp_get_mag32(&b) != 4) {
93+
if (mp_get_mag_u32(&b) != 4) {
9494
goto LBL_ERR;
9595
}
9696
/* a: -5-> b: 1 */
@@ -139,7 +139,7 @@ static int check_get_set_i32(mp_int *a, int32_t b)
139139
if (mp_shrink(a) != MP_OKAY) return EXIT_FAILURE;
140140
if (mp_get_i32(a) != b) return EXIT_FAILURE;
141141
if (mp_get_u32(a) != (uint32_t)b) return EXIT_FAILURE;
142-
if (mp_get_mag32(a) != uabs32(b)) return EXIT_FAILURE;
142+
if (mp_get_mag_u32(a) != uabs32(b)) return EXIT_FAILURE;
143143

144144
mp_set_u32(a, (uint32_t)b);
145145
if (mp_get_u32(a) != (uint32_t)b) return EXIT_FAILURE;
@@ -186,7 +186,7 @@ static int check_get_set_i64(mp_int *a, int64_t b)
186186
if (mp_shrink(a) != MP_OKAY) return EXIT_FAILURE;
187187
if (mp_get_i64(a) != b) return EXIT_FAILURE;
188188
if (mp_get_u64(a) != (uint64_t)b) return EXIT_FAILURE;
189-
if (mp_get_mag64(a) != uabs64(b)) return EXIT_FAILURE;
189+
if (mp_get_mag_u64(a) != uabs64(b)) return EXIT_FAILURE;
190190

191191
mp_set_u64(a, (uint64_t)b);
192192
if (mp_get_u64(a) != (uint64_t)b) return EXIT_FAILURE;

0 commit comments

Comments
 (0)