From e31461b53c3fead046e8a4f3b04798744ba6f375 Mon Sep 17 00:00:00 2001 From: cgd Date: Tue, 24 Mar 1998 23:17:21 +0000 Subject: [PATCH] use CHAR_MIN to determine if 'char' is unsigned, and conditionalize the code in __objc_code_char() appropriately. Thanks to Alan Barrett for providing a good way to do this. --- gnu/usr.bin/gcc/libobjc/archive.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gnu/usr.bin/gcc/libobjc/archive.c b/gnu/usr.bin/gcc/libobjc/archive.c index 0d5515270b41..0c21fd118cd8 100644 --- a/gnu/usr.bin/gcc/libobjc/archive.c +++ b/gnu/usr.bin/gcc/libobjc/archive.c @@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */ #include "runtime.h" #include "typedstream.h" #include "encoding.h" +#include /* for CHAR_MIN */ extern int fflush(FILE*); @@ -93,6 +94,11 @@ objc_write_unsigned_char (struct objc_typed_stream* stream, static __inline__ int __objc_code_char (unsigned char* buf, char val) { +#if (CHAR_MIN == 0) + /* char is unsigned on this machine */ + return __objc_code_unsigned_char (buf, val); +#else + /* char is signed on this machine */ if (val >= 0) return __objc_code_unsigned_char (buf, val); else @@ -101,6 +107,7 @@ __objc_code_char (unsigned char* buf, char val) buf[1] = -val; return 2; } +#endif } int