Mail Archives: djgpp-workers/1998/02/10/03:16:40
The following is an ANSI compliant behaving macro, and it supports also
'signed char'
It yields reasonably efficient hard-code.
#define isupper(c) ({int t=(c);unsigned v;\
++t;\
if(t<0)t+=256;\
v=__dj_ctype_flags[t];\
(v&__dj_ISUPPER)!=0;})
The following is an ANSI compliant behaving macro, it supports only
'unsigned char'.
It yields the most efficient hard-code possible in many cases.
#define isupper(c) ({int t=(c);unsigned v;\
++t;\
v=__dj_ctype_flags[t];\
(v&__dj_ISUPPER)!=0;})
Note that ANY change you will make to these macro's will turn them less
efficient. I know where I am talking about.
Note that if the first macro I propose is used on an 'unsigned char',
the test whether the value is negative is optimized out by the compiler.
The function version could not have this feature of course.
--
\ Vik /-_-_-_-_-_-_/
\___/ Heyndrickx /
\ /-_-_-_-_-_-_/
- Raw text -