/ Published in: C
several versions of isalpha
Expand |
Embed | Plain Text
inline const int isalpha2(char c){ return c>='a' && c<='z' || c>='A' && c<='Z'; } inline const int isalpha3(unsigned char c){ return --c>>6==1 & (c&31)<26; } inline const int isalpha4(unsigned char c){ unsigned char out; asm( "\n" "decb %1\n" "movb %1,%0\n" "shrb $6,%0\n" "cmpb $1,%0\n" "seteb %%al\n" "andb $31,%1\n" "cmpb $26,%1\n" "setlb %%ah\n" "cmpw $257,%%ax\n" "seteb %0\n" :"=q"(out) :"q"(c) :"ax" ); return out; }
You need to login to post a comment.
