From bffa84e0c25492f15646586ace7e4bb77bb2916e Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Thu, 4 Aug 2016 11:46:16 +0800 Subject: [PATCH] Fix `jl_static_show` for `bitstype` The byte gets sign extended when passing to the vararg `jl_printf` and then printed as an unsigned int which might come with unwanted `0xff` prefix... --- src/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtins.c b/src/builtins.c index b64c01be9611c..4698cab3afcbb 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -1479,7 +1479,7 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt size_t nb = jl_datatype_size(vt); size_t tlen = jl_datatype_nfields(vt); if (nb > 0 && tlen == 0) { - char *data = (char*)jl_data_ptr(v); + uint8_t *data = (uint8_t*)v; n += jl_printf(out, "0x"); for(int i=nb-1; i >= 0; --i) n += jl_printf(out, "%02" PRIx8, data[i]);