Skip to content

Commit 8e250cb

Browse files
committed
Feeding the correct types now
1 parent 71728fc commit 8e250cb

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

demo/shared.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void print_header(void)
3636
#ifdef MP_16BIT
3737
printf("Digit size 16 Bit \n");
3838
#endif
39-
#ifdef MP_32BIT
39+
#if ((defined MP_32BIT) || (defined MP_31BIT))
4040
printf("Digit size 32 Bit \n");
4141
#endif
4242
#ifdef MP_64BIT

demo/test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static int test_mp_printf_extension(void)
398398
"Left aligned AAA +0@JTpzuD8E+6OxDD6VWf/T BBB\n", /* 55 */
399399
"Right aligned AAA 0@JTpzuD8E+6OxDD6VWf/T BBB\n",
400400
"Left aligned AAA 0@JTpzuD8E+6OxDD6VWf/T BBB\n",
401-
#if ((MP_DIGIT_BIT == 60) && (UINT_MAX > 0xffffffffU) )
401+
#if (MP_DIGIT_BIT == 60)
402402
"Right aligned AAA 449010662782443485 BBB\n",
403403
"Left aligned AAA 449010662782443485 BBB\n",
404404
"Right aligned AAA +449010662782443485 BBB\n", /* 60 */
@@ -496,7 +496,7 @@ static int test_mp_printf_extension(void)
496496
"Left aligned AAA 0011111100000101001111111011101,1001100011101100110100110100011,0000011010010000011101111100001,0000010011011101110011111101111, BBB\n",
497497
"Right aligned AAA 0011111100000101001111111011101,1001100011101100110100110100011,0000011010010000011101111100001,0000010011011101110011111101111, BBB\n",
498498
"Left aligned AAA 0011111100000101001111111011101,1001100011101100110100110100011,0000011010010000011101111100001,0000010011011101110011111101111, BBB\n"
499-
#elif ((MP_DIGIT_BIT == 28) || ( (MP_DIGIT_BIT == 60) && (UINT_MAX == 0xffffffffU) ) )
499+
#elif ( MP_DIGIT_BIT == 28 )
500500
"Right aligned AAA 260218845 BBB\n",
501501
"Left aligned AAA 260218845 BBB\n",
502502
"Right aligned AAA +260218845 BBB\n",

mp_printf_extension_init.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,27 @@ static int s_mp_print_mp_int_arginfo(const struct printf_info *info, size_t n,
238238
*/
239239
(void)(info);
240240

241-
if (n > 0) {
241+
if ((n > 0) && (info->user & modZ)) {
242242
argtypes[0] = PA_POINTER;
243243
size[0] = sizeof(mp_int *);
244244
}
245+
if ((n > 0) && (info->user & modM)) {
246+
#if (MP_DIGIT_BIT > 32)
247+
argtypes[0] = PA_INT | PA_FLAG_LONG_LONG;
248+
#else
249+
argtypes[0] = PA_INT | PA_FLAG_LONG;
250+
#endif
251+
size[0] = sizeof(mp_digit);
252+
}
253+
254+
if ((n > 0) && (info->user & modN)) {
255+
#if (MP_DIGIT_BIT > 32)
256+
argtypes[0] = PA_INT | PA_FLAG_LONG_LONG;
257+
#else
258+
argtypes[0] = PA_INT | PA_FLAG_LONG;
259+
#endif
260+
size[0] = sizeof(mp_digit);
261+
}
245262
return 1;
246263
}
247264
/* Register printf extensions */

0 commit comments

Comments
 (0)