diff options
author | Karl Williamson <khw@cpan.org> | 2016-08-05 16:46:28 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-08-05 21:16:24 -0600 |
commit | 386941121a2747bb3987d9eadcdc46a1f4db017a (patch) | |
tree | f2fdc58074879b8ccb0cd71d236f03d0c271d2f8 /handy.h | |
parent | 8c67216a3fd00ab0d3b597cc85e6df24efc37b6a (diff) | |
download | perl-386941121a2747bb3987d9eadcdc46a1f4db017a.tar.gz |
Improve isOCTAL() definition
This potentially saves a branch
Diffstat (limited to 'handy.h')
-rw-r--r-- | handy.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -941,10 +941,10 @@ patched there. The file as of this writing is cpan/Devel-PPPort/parts/inc/misc # define isASCII(c) ((WIDEST_UTYPE)((c) | 0) < 128) #endif -/* The lower 3 bits in both the ASCII and EBCDIC representations of '0' are 0, - * and the 8 possible permutations of those bits exactly comprise the 8 octal - * digits */ -#define isOCTAL_A(c) cBOOL(FITS_IN_8_BITS(c) && (0xF8 & (c)) == '0') +/* Take the eight possible bit patterns of the lower 3 bits and you get the + * lower 3 bits of the 8 octal digits, in both ASCII and EBCDIC, so those bits + * can be ignored. If the rest match '0', we have an octal */ +#define isOCTAL_A(c) (((WIDEST_UTYPE)((c) | 0) & ~7) == '0') #ifdef H_PERL /* If have access to perl.h, lookup in its table */ |