Originally posted by Maverick
TOUPPER ASCII conversion.
On P6 class CPUs:
TOUPPER ASCII conversion.
On P6 class CPUs:
LEA ECX,[EAX-32]
LEA EBX,[EAX-'a']
CMP EBX,'z'+1-'a'
CMOVC EAX,ECX
Nice bit of code. Thanks! & I like the streamed-lined approach much better than my posted cludge.
There's something I don't understand tho... What happens to "{}~" ? Even if I restrict the range to printable ascii (which i don't... 16bit chars too) those are usually distinct chars we don't want to convert.
rafe
Hi rafe :)
This is as fast on all the CPU's I tested it on, but it could be faster in others:
PS: this post was edited because at first I thought you were asking something else (sorry, was doing 10 other things at once in multitasking-singlebrain ;) ).
:stupid:
Nice bit of code. Thanks! & I like the streamed-lined approach much better than my posted cludge.
Thanks.. but that's just a direct application of some simple rules and techniques I explained in detail in two other posts.
This is as fast on all the CPU's I tested it on, but it could be faster in others:
LEA EBX,[EAX-'a']
LEA ECX,[EAX-32]
CMP EBX,BYTE 'z'+1-'a'
CMOVC EAX,ECX
There's something I don't understand tho... What happens to "{}~" ? Even if I restrict the range to printable ascii (which i don't... 16bit chars too) those are usually distinct chars we don't want to convert.
Then the above code works perfectly. It changes the case only of 'a'..'z', and nothing else.
PS: this post was edited because at first I thought you were asking something else (sorry, was doing 10 other things at once in multitasking-singlebrain ;) ).
:stupid:
My bad. Boy did I misread the snippet... works like a charm... as you knew.
Bwain no go sometimes :grin:
Bwain no go sometimes :grin: