diff options
author | Sverker Eriksson <[email protected]> | 2013-02-22 15:46:52 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-02-22 15:47:02 +0100 |
commit | 2ff92dc7c2aa5c052df47776b782500815ce72eb (patch) | |
tree | aacbf3acec409887c39493b59eff785649c4b0ec | |
parent | 17231ca24cbf3b136301f1076bb94247344e9f35 (diff) | |
parent | 944fca78d202712848e317ec666647e8db78bcb4 (diff) | |
download | otp-2ff92dc7c2aa5c052df47776b782500815ce72eb.tar.gz otp-2ff92dc7c2aa5c052df47776b782500815ce72eb.tar.bz2 otp-2ff92dc7c2aa5c052df47776b782500815ce72eb.zip |
Merge branch 'sverk/win-64-pointer-fix'
* sverk/win-64-pointer-fix:
erts: Correct term type for printf %T
erts: Correct internal printf integer type for win64
erts: Correct some printf type formatting
erts: Fix type bug in get_proc_affinity for windows
OTP-10887
Forgot this ticket for sverk/erlang_pid-revert:
OTP-10885
-rw-r--r-- | erts/emulator/beam/beam_catches.c | 7 | ||||
-rw-r--r-- | erts/emulator/beam/erl_db_util.c | 11 | ||||
-rw-r--r-- | erts/emulator/beam/erl_gc.c | 2 | ||||
-rw-r--r-- | erts/emulator/beam/erl_printf_term.c | 63 | ||||
-rw-r--r-- | erts/emulator/beam/erl_printf_term.h | 4 | ||||
-rw-r--r-- | erts/include/internal/erl_printf_format.h | 34 | ||||
-rw-r--r-- | erts/lib_src/common/erl_misc_utils.c | 3 | ||||
-rw-r--r-- | erts/lib_src/common/erl_printf_format.c | 74 |
8 files changed, 113 insertions, 85 deletions
diff --git a/erts/emulator/beam/beam_catches.c b/erts/emulator/beam/beam_catches.c index 7c92408eea..d374d0469e 100644 --- a/erts/emulator/beam/beam_catches.c +++ b/erts/emulator/beam/beam_catches.c @@ -160,10 +160,9 @@ void beam_catches_delmod(unsigned head, BeamInstr *code, unsigned code_bytes, } if( (char*)p->beam_catches[i].cp - (char*)code >= code_bytes ) { erl_exit(1, - "beam_catches_delmod: item %#x has cp %#lx which is not " - "in module's range [%#lx,%#lx[\r\n", - i, (long)p->beam_catches[i].cp, - (long)code, (long)((char*)code + code_bytes)); + "beam_catches_delmod: item %#x has cp %p which is not " + "in module's range [%p,%p[\r\n", + i, p->beam_catches[i].cp, code, ((char*)code + code_bytes)); } p->beam_catches[i].cp = 0; cdr = p->beam_catches[i].cdr; diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c index fc1c946c7d..713ac0ba18 100644 --- a/erts/emulator/beam/erl_db_util.c +++ b/erts/emulator/beam/erl_db_util.c @@ -3415,8 +3415,7 @@ static DMCRet dmc_one_term(DMCContext *context, } default: erl_exit(1, "db_match_compile: " - "Bad object on heap: 0x%08lx\n", - (unsigned long) c); + "Bad object on heap: 0x%bex\n", c); } return retOk; } @@ -4861,7 +4860,7 @@ static Eterm my_copy_struct(Eterm t, Eterm **hp, ErlOffHeap* off_heap) ret = copy_struct(b,sz,hp,off_heap); } else { erl_exit(1, "Trying to constant-copy non constant expression " - "0x%08x in (d)ets:match compilation.", (unsigned long) t); + "0x%bex in (d)ets:match compilation.", t); } } else { sz = size_object(t); @@ -5395,7 +5394,7 @@ void db_match_dis(Binary *bp) erts_printf("Caller\n"); break; default: - erts_printf("??? (0x%08x)\n", *t); + erts_printf("??? (0x%bpx)\n", *t); ++t; break; } @@ -5407,13 +5406,13 @@ void db_match_dis(Binary *bp) first = 0; else erts_printf(", "); - erts_printf("0x%08x", (unsigned long) tmp); + erts_printf("%p", tmp); } erts_printf("}\n"); erts_printf("num_bindings: %d\n", prog->num_bindings); erts_printf("heap_size: %beu\n", prog->heap_size); erts_printf("stack_offset: %beu\n", prog->stack_offset); - erts_printf("text: 0x%08x\n", (unsigned long) prog->text); + erts_printf("text: %p\n", prog->text); erts_printf("stack_size: %d (words)\n", prog->heap_size-prog->stack_offset); } diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c index a33085315a..293d9fa3ec 100644 --- a/erts/emulator/beam/erl_gc.c +++ b/erts/emulator/beam/erl_gc.c @@ -231,7 +231,7 @@ erts_next_heap_size(Uint size, Uint offset) low = mid + 1; } } - erl_exit(1, "no next heap size found: %lu, offset %lu\n", (unsigned long)size, (unsigned long)offset); + erl_exit(1, "no next heap size found: %beu, offset %beu\n", size, offset); } return 0; } diff --git a/erts/emulator/beam/erl_printf_term.c b/erts/emulator/beam/erl_printf_term.c index 2320b64295..ce544503bd 100644 --- a/erts/emulator/beam/erl_printf_term.c +++ b/erts/emulator/beam/erl_printf_term.c @@ -57,17 +57,17 @@ do { \ (CNT) += res__; \ } while (0) -#define PRINT_ULONG(CNT, FN, ARG, C, P, W, I) \ +#define PRINT_UWORD(CNT, FN, ARG, C, P, W, I) \ do { \ - int res__ = erts_printf_ulong((FN), (ARG), (C), (P), (W), (I)); \ + int res__ = erts_printf_uword((FN), (ARG), (C), (P), (W), (I)); \ if (res__ < 0) \ return res__; \ (CNT) += res__; \ } while (0) -#define PRINT_SLONG(CNT, FN, ARG, C, P, W, I) \ +#define PRINT_SWORD(CNT, FN, ARG, C, P, W, I) \ do { \ - int res__ = erts_printf_slong((FN), (ARG), (C), (P), (W), (I)); \ + int res__ = erts_printf_sword((FN), (ARG), (C), (P), (W), (I)); \ if (res__ < 0) \ return res__; \ (CNT) += res__; \ @@ -153,7 +153,7 @@ static int print_atom_name(fmtfn_t fn, void* arg, Eterm atom, long *dcount) if ((i < 0) || (i >= atom_table_size()) || (atom_tab(i) == NULL)) { PRINT_STRING(res, fn, arg, "<bad atom index: "); - PRINT_SLONG(res, fn, arg, 'd', 0, 1, (signed long) i); + PRINT_SWORD(res, fn, arg, 'd', 0, 1, (ErlPfSWord) i); PRINT_CHAR(res, fn, arg, '>'); return res; } @@ -203,7 +203,7 @@ static int print_atom_name(fmtfn_t fn, void* arg, Eterm atom, long *dcount) default: if (IS_CNTRL(c)) { PRINT_CHAR(res, fn, arg, '\\'); - PRINT_ULONG(res, fn, arg, 'o', 1, 3, (unsigned long) c); + PRINT_UWORD(res, fn, arg, 'o', 1, 3, (ErlPfUWord) c); } else PRINT_CHAR(res, fn, arg, (char) c); @@ -334,7 +334,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, break; } case SMALL_DEF: - PRINT_SLONG(res, fn, arg, 'd', 0, 1, (signed long) signed_val(obj)); + PRINT_SWORD(res, fn, arg, 'd', 0, 1, (ErlPfSWord) signed_val(obj)); break; case BIG_DEF: { int print_res; @@ -360,36 +360,36 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, case REF_DEF: case EXTERNAL_REF_DEF: PRINT_STRING(res, fn, arg, "#Ref<"); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, - (unsigned long) ref_channel_no(wobj)); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, + (ErlPfUWord) ref_channel_no(wobj)); ref_num = ref_numbers(wobj); for (i = ref_no_of_numbers(wobj)-1; i >= 0; i--) { PRINT_CHAR(res, fn, arg, '.'); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, (unsigned long) ref_num[i]); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, (ErlPfUWord) ref_num[i]); } PRINT_CHAR(res, fn, arg, '>'); break; case PID_DEF: case EXTERNAL_PID_DEF: PRINT_CHAR(res, fn, arg, '<'); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, - (unsigned long) pid_channel_no(wobj)); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, + (ErlPfUWord) pid_channel_no(wobj)); PRINT_CHAR(res, fn, arg, '.'); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, - (unsigned long) pid_number(wobj)); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, + (ErlPfUWord) pid_number(wobj)); PRINT_CHAR(res, fn, arg, '.'); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, - (unsigned long) pid_serial(wobj)); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, + (ErlPfUWord) pid_serial(wobj)); PRINT_CHAR(res, fn, arg, '>'); break; case PORT_DEF: case EXTERNAL_PORT_DEF: PRINT_STRING(res, fn, arg, "#Port<"); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, - (unsigned long) port_channel_no(wobj)); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, + (ErlPfUWord) port_channel_no(wobj)); PRINT_CHAR(res, fn, arg, '.'); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, - (unsigned long) port_number(wobj)); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, + (ErlPfUWord) port_number(wobj)); PRINT_CHAR(res, fn, arg, '>'); break; case LIST_DEF: @@ -446,7 +446,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, PRINT_STRING(res, fn, arg, "<<1 byte>>"); else { PRINT_STRING(res, fn, arg, "<<"); - PRINT_ULONG(res, fn, arg, 'u', 0, 1, (unsigned long) pb->size); + PRINT_UWORD(res, fn, arg, 'u', 0, 1, (ErlPfUWord) pb->size); PRINT_STRING(res, fn, arg, " bytes>>"); } } @@ -462,8 +462,8 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, PRINT_CHAR(res, fn, arg, '.'); PRINT_BUF(res, fn, arg, name->name, name->len); PRINT_CHAR(res, fn, arg, '.'); - PRINT_SLONG(res, fn, arg, 'd', 0, 1, - (signed long) ep->code[2]); + PRINT_SWORD(res, fn, arg, 'd', 0, 1, + (ErlPfSWord) ep->code[2]); PRINT_CHAR(res, fn, arg, '>'); } break; @@ -475,11 +475,11 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, PRINT_STRING(res, fn, arg, "#Fun<"); PRINT_BUF(res, fn, arg, ap->name, ap->len); PRINT_CHAR(res, fn, arg, '.'); - PRINT_SLONG(res, fn, arg, 'd', 0, 1, - (signed long) funp->fe->old_index); + PRINT_SWORD(res, fn, arg, 'd', 0, 1, + (ErlPfSWord) funp->fe->old_index); PRINT_CHAR(res, fn, arg, '.'); - PRINT_SLONG(res, fn, arg, 'd', 0, 1, - (signed long) funp->fe->old_uniq); + PRINT_SWORD(res, fn, arg, 'd', 0, 1, + (ErlPfSWord) funp->fe->old_uniq); PRINT_CHAR(res, fn, arg, '>'); } break; @@ -498,10 +498,13 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount, } int -erts_printf_term(fmtfn_t fn, void* arg, unsigned long term, long precision, - unsigned long* term_base) +erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision, + ErlPfEterm* term_base) { - int res = print_term(fn, arg, (Eterm)term, &precision, (Eterm*)term_base); + int res; + ASSERT(sizeof(ErlPfEterm) == sizeof(Eterm)); + + res = print_term(fn, arg, (Eterm)term, &precision, (Eterm*)term_base); if (res < 0) return res; if (precision <= 0) diff --git a/erts/emulator/beam/erl_printf_term.h b/erts/emulator/beam/erl_printf_term.h index a48a3de34c..d9bf79a5ce 100644 --- a/erts/emulator/beam/erl_printf_term.h +++ b/erts/emulator/beam/erl_printf_term.h @@ -21,6 +21,6 @@ #define ERL_PRINTF_TERM_H__ #include "erl_printf_format.h" -int erts_printf_term(fmtfn_t fn, void* arg, unsigned long term, long precision, - unsigned long* term_base); +int erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision, + ErlPfEterm* term_base); #endif diff --git a/erts/include/internal/erl_printf_format.h b/erts/include/internal/erl_printf_format.h index 064c4a5c09..0f35c41044 100644 --- a/erts/include/internal/erl_printf_format.h +++ b/erts/include/internal/erl_printf_format.h @@ -28,6 +28,22 @@ #include <stdarg.h> #include <stdlib.h> +#include "erl_int_sizes_config.h" + +#if SIZEOF_VOID_P == SIZEOF_LONG +typedef unsigned long ErlPfUWord; +typedef long ErlPfSWord; +#elif SIZEOF_VOID_P == SIZEOF_INT +typedef unsigned int ErlPfUWord; +typedef int ErlPfSWord; +#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG +typedef unsigned long long ErlPfUWord; +typedef long long ErlPfSWord; +#else +#error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint' +#endif + + typedef int (*fmtfn_t)(void*, char*, size_t); extern int erts_printf_format(fmtfn_t, void*, char*, va_list); @@ -36,11 +52,21 @@ extern int erts_printf_char(fmtfn_t, void*, char); extern int erts_printf_string(fmtfn_t, void*, char *); extern int erts_printf_buf(fmtfn_t, void*, char *, size_t); extern int erts_printf_pointer(fmtfn_t, void*, void *); -extern int erts_printf_ulong(fmtfn_t, void*, char, int, int, unsigned long); -extern int erts_printf_slong(fmtfn_t, void*, char, int, int, signed long); +extern int erts_printf_uword(fmtfn_t, void*, char, int, int, ErlPfUWord); +extern int erts_printf_sword(fmtfn_t, void*, char, int, int, ErlPfSWord); extern int erts_printf_double(fmtfn_t, void *, char, int, int, double); -extern int (*erts_printf_eterm_func)(fmtfn_t, void*, unsigned long, long, unsigned long*); - +#ifdef HALFWORD_HEAP_EMULATOR +# if SIZEOF_INT != 4 +# error Unsupported integer size for HALFWORD_HEAP_EMULATOR +# endif +typedef unsigned int ErlPfEterm; +#else +typedef ErlPfUWord ErlPfEterm; #endif +extern int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long, ErlPfEterm*); + + +#endif /* ERL_PRINTF_FORMAT_H__ */ + diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c index 11e2c56f61..9e9c142449 100644 --- a/erts/lib_src/common/erl_misc_utils.c +++ b/erts/lib_src/common/erl_misc_utils.c @@ -192,7 +192,8 @@ struct erts_cpu_info_t_ { static __forceinline int get_proc_affinity(erts_cpu_info_t *cpuinfo, cpu_set_t *cpuset) { - DWORD pamask, samask; + DWORD_PTR pamask; + DWORD_PTR samask; if (GetProcessAffinityMask(GetCurrentProcess(), &pamask, &samask)) { *cpuset = (cpu_set_t) pamask; return 0; diff --git a/erts/lib_src/common/erl_printf_format.c b/erts/lib_src/common/erl_printf_format.c index 00df3f068f..5034ea6668 100644 --- a/erts/lib_src/common/erl_printf_format.c +++ b/erts/lib_src/common/erl_printf_format.c @@ -165,7 +165,7 @@ static char heX[] = "0123456789ABCDEF"; #define SIGN(X) ((X) > 0 ? 1 : ((X) < 0 ? -1 : 0)) #define USIGN(X) ((X) == 0 ? 0 : 1) -int (*erts_printf_eterm_func)(fmtfn_t, void*, unsigned long, long, unsigned long*) = NULL; +int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long, ErlPfEterm*) = NULL; static int noop_fn(void *vfp, char* buf, size_t len) @@ -234,7 +234,7 @@ static int fmt_fld(fmtfn_t fn,void* arg, return 0; } -static int fmt_long(fmtfn_t fn,void* arg,int sign,unsigned long uval, +static int fmt_uword(fmtfn_t fn,void* arg,int sign,ErlPfUWord uval, int width,int precision,int fmt,int* count) { char buf[32]; @@ -475,7 +475,7 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) int res = 0; while(*ptr) { - unsigned long ul_val; + ErlPfUWord ul_val; int fmt = 0; int width = -1; int precision = -1; @@ -661,22 +661,22 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) switch(fmt & FMTL_MASK) { case FMTL_hh: { signed char tval = (signed char) va_arg(ap,int); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_h: { signed short tval = (signed short) va_arg(ap,int); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_l: { signed long tval = (signed long) va_arg(ap,long); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } @@ -693,8 +693,8 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) #endif default: { signed int tval = (signed int) va_arg(ap,int); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } @@ -707,21 +707,21 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) switch(fmt & FMTL_MASK) { case FMTL_hh: { unsigned char tval = (unsigned char) va_arg(ap,int); - ul_val = (unsigned long) tval; - res = fmt_long(fn,arg,USIGN(tval),ul_val, + ul_val = (ErlPfUWord) tval; + res = fmt_uword(fn,arg,USIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_h: { unsigned short tval = (unsigned short) va_arg(ap,int); - ul_val = (unsigned long) tval; - res = fmt_long(fn,arg,USIGN(tval),ul_val, + ul_val = (ErlPfUWord) tval; + res = fmt_uword(fn,arg,USIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_l: { - ul_val = (unsigned long) va_arg(ap,long); - res = fmt_long(fn,arg,USIGN(ul_val),ul_val, + ul_val = (ErlPfUWord) va_arg(ap,long); + res = fmt_uword(fn,arg,USIGN(ul_val),ul_val, width,precision,fmt,&count); break; } @@ -736,8 +736,8 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) #endif default: { unsigned int tval = (unsigned int) va_arg(ap,int); - ul_val = (unsigned long) tval; - res = fmt_long(fn,arg,USIGN(tval),ul_val, + ul_val = (ErlPfUWord) tval; + res = fmt_uword(fn,arg,USIGN(tval),ul_val, width,precision,fmt,&count); break; } @@ -795,10 +795,10 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) case FMTC_p: { void* addr = va_arg(ap, void*); - res = fmt_long(fn, + res = fmt_uword(fn, arg, - USIGN((unsigned long) addr), - (unsigned long) addr, + USIGN((ErlPfUWord) addr), + (ErlPfUWord) addr, width < 0 ? ((int) 2*sizeof(void *)) : width, (precision < 0 ? ((int) 2*sizeof(void *)) @@ -822,8 +822,8 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) case FMTC_T: /* Eterm */ case FMTC_R: { /* Eterm, Eterm* base (base ignored if !HALFWORD_HEAP) */ long prec; - unsigned long eterm; - unsigned long* eterm_base; + ErlPfEterm eterm; + ErlPfEterm* eterm_base; if (!erts_printf_eterm_func) return -EINVAL; @@ -833,9 +833,9 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) prec = LONG_MAX; else prec = (long) precision; - eterm = va_arg(ap, unsigned long); + eterm = va_arg(ap, ErlPfEterm); eterm_base = ((fmt & FMTC_MASK) == FMTC_R) ? - va_arg(ap, unsigned long*) : NULL; + va_arg(ap, ErlPfEterm*) : NULL; if (width > 0 && !(fmt & FMTF_adj)) { res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec, eterm_base); if (res < 0) @@ -890,8 +890,8 @@ int erts_printf_pointer(fmtfn_t fn, void *arg, void *ptr) { int count = 0; - int res = fmt_long(fn, arg, USIGN((unsigned long) ptr), - (unsigned long) ptr, 2*sizeof(void *), + int res = fmt_uword(fn, arg, USIGN((ErlPfUWord) ptr), + (ErlPfUWord) ptr, 2*sizeof(void *), 2*sizeof(void *), FMTC_x|FMTF_pad|FMTF_alt, &count); if (res < 0) return res; @@ -899,8 +899,8 @@ erts_printf_pointer(fmtfn_t fn, void *arg, void *ptr) } int -erts_printf_ulong(fmtfn_t fn, void *arg, char conv, int pad, int width, - unsigned long val) +erts_printf_uword(fmtfn_t fn, void *arg, char conv, int pad, int width, + ErlPfUWord val) { int count = 0; int res; @@ -917,21 +917,21 @@ erts_printf_ulong(fmtfn_t fn, void *arg, char conv, int pad, int width, } if (pad) prec = width; - res = fmt_long(fn, arg, USIGN(val), val, width, prec, fmt, &count); + res = fmt_uword(fn, arg, USIGN(val), val, width, prec, fmt, &count); if (res < 0) return res; return count; } -extern int -erts_printf_slong(fmtfn_t fn, void *arg, char conv, int pad, int width, - signed long val) +int +erts_printf_sword(fmtfn_t fn, void *arg, char conv, int pad, int width, + ErlPfSWord val) { int count = 0; int res; int fmt = 0; int prec = -1; - unsigned long ul_val; + ErlPfUWord ul_val; switch (conv) { case 'd': fmt |= FMTC_d; break; case 'i': fmt |= FMTC_d; break; @@ -943,8 +943,8 @@ erts_printf_slong(fmtfn_t fn, void *arg, char conv, int pad, int width, } if (pad) prec = width; - ul_val = (unsigned long) (val < 0 ? -val : val); - res = fmt_long(fn, arg, SIGN(val), ul_val, width, prec, fmt, &count); + ul_val = (ErlPfUWord) (val < 0 ? -val : val); + res = fmt_uword(fn, arg, SIGN(val), ul_val, width, prec, fmt, &count); if (res < 0) return res; return count; |