From 9691e330b94a05beba6f4d9c778971b42922e887 Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 14 Jan 2018 00:47:11 +0000 Subject: [PATCH] =?UTF-8?q?after=20literally=20HOURS=20of=20debugging,=20I?= =?UTF-8?q?=20got=20a=20working-ish=20expression=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sh.h b/sh.h index be151cb..69f311a 100644 --- a/sh.h +++ b/sh.h @@ -182,7 +182,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.854 2018/01/14 00:22:29 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.855 2018/01/14 00:47:11 tg Exp $"); #endif #define MKSH_VERSION "R56 2017/10/17" @@ -1474,16 +1474,16 @@ EXTERN char ifs0; extern unsigned int eek_ord; #define ORD(c) ((size_t)(c) > 0xFF ? eek_ord : \ ((unsigned int)(unsigned char)(c))) -#define Oc(c,t) __builtin_types_compatible_p(__typeof__(c), t) -#define ord(c) __builtin_choose_expr( \ - Oc((c), unsigned char) || Oc((c), char), \ - ((unsigned int)(unsigned char)(c)), ({ \ - size_t ord_c = (c); \ - \ - if (ord_c > 0xFF) \ - internal_errorf("%s:%d:ord(%zu)", \ - __FILE__, __LINE__, ord_c); \ - ((unsigned int)(unsigned char)(c)); \ +#define ord(c) __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof__(c), char) || \ + __builtin_types_compatible_p(__typeof__(c), unsigned char), \ + ((unsigned int)(unsigned char)(c)), ({ \ + size_t ord_c = (c); \ + \ + if (ord_c > (size_t)0xFFU) \ + internal_errorf("%s:%d:ord(%zu)", \ + __FILE__, __LINE__, ord_c); \ + ((unsigned int)(unsigned char)(ord_c)); \ })) #else #define ord(c) ((unsigned int)(unsigned char)(c))