Thanks for your comment,
but no, I didn't talk about performance.
I understand this is not very costly, especially compared with other crypto operations. My concern was mostly about keeping the source code easy to understand and 'logically consistent'.

I am trying to save the reader from asking himself "what is the use of the '& 0x7F' masking operation ?".

Le 25/08/2013 12:23, PMHager a écrit :
If your intention is performance optimization you could even replace

   if((*p & 0x80) == 0)
with
   if((signed char)(*p) >= 0)

as you cannot assume that all compilers will do it correctly themselves.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Michel
Sent: Thursday, August 22, 2013 11:44 AM
To: [email protected]
Subject: UTF8 decoding, unneeded byte masking

In a_utf8.c, lines 85 and 86 (1.0.1e) :

...
   if((*p & 0x80) == 0) {     //  as this byte looks like : 0xxxxxxx
       value = *p++ & 0x7f;   //  this line could as well be written : value = 
*p++;
...

If I don't  miss something, it would seems clearer to me.



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to