DMD 1.019 and 2.003 releases

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Tue Jul 24 15:53:24 PDT 2007


Walter Bright wrote:
> BCS wrote:
>> Reply to Walter,
>>
>>>
>>> c += 'a' - 'A';   // to lower case
>>
>> this is safer and faster (Ihink)
>>
>> c |= 0b0010_0000;
> 
> 
> On modern processors, there is no speed difference between the two. I 
> prefer the former only because I can't remember which bit it is <g>.

Well, that's easy:
---
c |= 'a' ^ 'A';
---
:P

Of course, then you'd have to remember whether the bit should be 1 or 0...


And of course both methods will screw up for a lot of characters that 
aren't latin letters.



More information about the Digitalmars-d-announce mailing list