On Mon, 2021-07-26 at 15:44 -0400, Andrew MacLeod wrote: > I'm testing this... Think this'll work better? we don't support > any > character sets where a space is 32 but it isnt ASCI.. and 64 isnt > EBCDIC?
Not sure; libcpp has some code for EBCDIC support, but it seems to be for the host, not the target. Maybe test for the target's ('z' - 'a') and ('Z' - 'A') being 25, which would imply that there are no gaps; don't optimize if that's not the case??? Sorry for opening this can of worms (I think I'm still in recovery from Python 2's "interesting" handling of string encoding). Dave > > This should handle those 2 sets.. and if is something else, it bails. > > This seems OK? Im testing it now on x86-64... but dont have an > ebcdic > target... > > Andrew > > > On 7/26/21 2:39 PM, David Malcolm wrote: > > On Mon, 2021-07-26 at 14:21 -0400, Andrew MacLeod via Gcc-patches > > wrote: > > > Remove lower case characters from the range of to_upper and > > > likewise, > > > upper case characters from to_lower. > > > > > > I looked at also only adding the upper case characters for which > > > there > > > is a lower_case character in the range, but it seemed of limited > > > use > > > Given some odd usage patterns we emit. . Instead, I > > > fold_using_range::range_of_builtin_callsimply took the > > > incoming range, removed the "from" character set, and added the > > > "to" > > > character set. This'll preserve any odd things that are passed > > > into it > > > while providing the basic functionality. > > > > > > Easy enough for someone to enhance if they feel so inclined. > > > > > > Bootstrapped on x86_64-pc-linux-gnu with no regressions. > > > Pushed. > > Awkward question: does this work with character sets where there > > are > > non-letter characters between 'a' and 'z' and between 'A' and 'Z' > > (e.g. > > EBCDIC [1])? > > > > For example toupper('~') should return '~', but '~' is between 'a' > > and > > 'z' in EBCDIC; likewise tolower('}') should return '}', but '}' is > > between 'A' and 'Z' in EBCDIC. > > > > Dave > > > > [1] https://en.wikipedia.org/wiki/EBCDIC > > >