Skip to content

Commit

Permalink
Extended c89 handling
Browse files Browse the repository at this point in the history
  • Loading branch information
czurnieden committed May 30, 2023
1 parent 8a4221f commit 82c5cd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 6 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ c89:
-e 's/INT64_MAX/(mp_i64)(((mp_u64)1<<63)-1)/g' \
-e 's/INT64_MIN/(mp_i64)((mp_u64)1<<63)/g' \
-e 's/SIZE_MAX/((size_t)-1)/g' \
-e 's/\(PRI[iux]64\)/MP_\1/g' \
-e 's/\([^u]\)intmax_t/\1__intmax_t/g' \
-e 's/uintmax_t/__uintmax_t/g' \
-e 's/\(PRI[ioux]64\)/MP_\1/g' \
-e 's/uint\([0-9][0-9]*\)_t/mp_u\1/g' \
-e 's/int\([0-9][0-9]*\)_t/mp_i\1/g' \
-e 's/__func__/MP_FUNCTION_NAME/g' \
Expand All @@ -195,7 +197,9 @@ c99:
-e 's/(mp_i64)((mp_u64)1<<63)/INT64_MIN/g' \
-e 's/(mp_i64)(((mp_u64)1<<63)-1)/INT64_MAX/g' \
-e 's/((size_t)-1)/SIZE_MAX/g' \
-e 's/MP_\(PRI[iux]64\)/\1/g' \
-e 's/__intmax_t/intmax_t/g' \
-e 's/__uintmax_t/uintmax_t/g' \
-e 's/MP_\(PRI[iuox]64\)/\1/g' \
-e 's/mp_u\([0-9][0-9]*\)/uint\1_t/g' \
-e 's/mp_i\([0-9][0-9]*\)/int\1_t/g' \
-e 's/MP_FUNCTION_NAME/__func__/g' \
Expand Down
10 changes: 5 additions & 5 deletions s_mp_fprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ static int s_mp_print_limb(const mp_digit d, const char *format, int base, bool
#elif defined(MP_64BIT)
switch (base) {
case 8:
/*
its defined in the local inttype.h as
/*
its defined in the local inttype.h as
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
Expand All @@ -175,11 +175,11 @@ its defined in the local inttype.h as
# define __PRIPTR_PREFIX
# endif
...
...
# define PRIo64 __PRI64_PREFIX "o"
*/
*/
f = strcat(f, PRIo64);
break;
case 10:
Expand Down Expand Up @@ -362,7 +362,7 @@ int s_mp_fprintf(FILE *stream, const char *format, va_list args)
}
break;
case 'j':
printed_characters += fprintf(stream, format_out, va_arg(args, intmax_t));
printed_characters += fprintf(stream, format_out, va_arg(args,intmax_t));
break;
case 't':
printed_characters += fprintf(stream, format_out, va_arg(args, ptrdiff_t));
Expand Down
1 change: 1 addition & 0 deletions tommath_c89.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ typedef __UINT64_TYPE__ mp_u64;
#define MP_PRIi64 MP_PRI64_PREFIX "i"
#define MP_PRIu64 MP_PRI64_PREFIX "u"
#define MP_PRIx64 MP_PRI64_PREFIX "x"
#define MP_PRIo64 MP_PRI64_PREFIX "o"

#define MP_FUNCTION_NAME __func__

0 comments on commit 82c5cd4

Please sign in to comment.