Em Mon, Apr 01, 2013 at 03:19:28PM +0900, Namhyung Kim escreveu: > On Fri, 29 Mar 2013 12:29:50 -0700, Sukadev Bhattiprolu wrote: > > Subject: [PATCH] perf: fix bug in isupper() and islower()
> > One of the reasons 'perf test' is failing on Power appears to be due to > > a bug in isupper(). > > isupper(c) and islower(c) should be checking 'c' against the mask 0x20. > > Instead they are checking sane_ctype[c] which causes isupper() to be true > > for lower case letters. > Indeed! > Acked-by: Namhyung Kim <namhy...@kernel.org> But can we try to use the same defs as for the kernel? Or at least sync this code against git.git, that is where it comes from? There we have: #define islower(x) sane_iscase(x, 1) #define isupper(x) sane_iscase(x, 0) #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) static inline int sane_iscase(int x, int is_lower) { if (!sane_istest(x, GIT_ALPHA)) return 0; if (is_lower) return (x & 0x20) != 0; else return (x & 0x20) == 0; } ---------------------------------------------------------------------------- In the kernel we have instead: include/linux/ctype.h #define _U 0x01 /* upper */ #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) #define isupper(c) ((__ismask(c)&(_U)) != 0) ---------------------------------------------------------------------------- I'm merging this fix now, as it improves things, but this seemingly needless speciations looks insane, would be great to have at least tools/perf/ using the same stuff as its landlord, the kernel. - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/