From bc18a8e7f735f4fef1cb2b781f7aef1e4ac86a43 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 25 Feb 1993 14:27:40 +0000 Subject: (print_s_char, print_s_short): Fix printing of signed chars and signed shorts. --- src/od.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/od.c b/src/od.c index 0e9161b26..b18189f57 100644 --- a/src/od.c +++ b/src/od.c @@ -402,10 +402,7 @@ print_s_char (n_bytes, block, fmt_string) int i; for (i = n_bytes; i > 0; i--) { - int tmp = (unsigned) *(const unsigned char *) block; - if (tmp > SCHAR_MAX) - tmp = (SCHAR_MAX - tmp); - assert (tmp <= SCHAR_MAX); + int tmp = (unsigned) *(const signed char *) block; printf (fmt_string, tmp, (i == 1 ? '\n' : ' ')); block += sizeof (unsigned char); } @@ -435,10 +432,7 @@ print_s_short (n_bytes, block, fmt_string) int i; for (i = n_bytes / sizeof (unsigned short); i > 0; i--) { - int tmp = (unsigned) *(const unsigned short *) block; - if (tmp > SHRT_MAX) - tmp = (SHRT_MAX - tmp); - assert (tmp <= SHRT_MAX); + int tmp = (unsigned) *(const signed short *) block; printf (fmt_string, tmp, (i == 1 ? '\n' : ' ')); block += sizeof (unsigned short); } -- cgit v1.2.3-70-g09d2