Re: Fastcode UpperCase B&V 0.2

From: Aleksandr Sharahov (alsha_at_mailru.com)
Date: 10/01/03


Date: Wed, 1 Oct 2003 20:02:35 +0400


"John O'Harrow"
> Possibly of interest to others - In developing these, I have invented a
new
> fast technique for converting an 'a'..'z' character into uppercase without
> any branches (It's so simple, I don't know why it hasn't been done before)
> :-
>
> {Convert character in AL to Uppercase}
> sub al, 'a'
> sub al, 26
> sbb ecx, ecx
> and cl, -$20
> add al, 'a'+26
> add al, cl

Hi John

I think, this loop must be faster:

movzx eax, [.]
xor ecx, ecx
sub eax, 'a'
sub eax, 26
sbb ecx, 0
add eax, 'a'+26
and ecx, -32
add eax, ecx
mov [.], al

--
regards,
Aleksandr.


Relevant Pages