@@ -62,16 +62,25 @@ enum {
6262#ifdef BASE64_NO_TABLE
6363static WC_INLINE byte Base64_Char2Val (byte c )
6464{
65- word16 v = 0x0000 ;
66-
67- v |= 0xff3E & ctMask16Eq (c , 0x2b );
68- v |= 0xff3F & ctMask16Eq (c , 0x2f );
69- v |= (c + 0xff04 ) & ctMask16GTE (c , 0x30 ) & ctMask16LTE (c , 0x39 );
70- v |= (0xff00 + c - 0x41 ) & ctMask16GTE (c , 0x41 ) & ctMask16LTE (c , 0x5a );
71- v |= (0xff00 + c - 0x47 ) & ctMask16GTE (c , 0x61 ) & ctMask16LTE (c , 0x7a );
72- v |= ~(v >> 8 );
73-
74- return (byte )v ;
65+ word16 v ;
66+ sword16 smallEnd = (sword16 )c - 0x7b ;
67+ sword16 smallStart = (sword16 )c - 0x61 ;
68+ sword16 bigEnd = (sword16 )c - 0x5b ;
69+ sword16 bigStart = (sword16 )c - 0x41 ;
70+ sword16 numEnd = (sword16 )c - 0x3a ;
71+ sword16 numStart = (sword16 )c - 0x30 ;
72+ sword16 slashEnd = (sword16 )c - 0x30 ;
73+ sword16 slashStart = (sword16 )c - 0x2f ;
74+ sword16 plusEnd = (sword16 )c - 0x2c ;
75+ sword16 plusStart = (sword16 )c - 0x2b ;
76+
77+ v = ((smallStart >> 8 ) ^ (smallEnd >> 8 )) & (smallStart + 26 + 1 );
78+ v |= ((bigStart >> 8 ) ^ (bigEnd >> 8 )) & (bigStart + 0 + 1 );
79+ v |= ((numStart >> 8 ) ^ (numEnd >> 8 )) & (numStart + 52 + 1 );
80+ v |= ((slashStart >> 8 ) ^ (slashEnd >> 8 )) & (slashStart + 63 + 1 );
81+ v |= ((plusStart >> 8 ) ^ (plusEnd >> 8 )) & (plusStart + 62 + 1 );
82+
83+ return (byte )(v - 1 );
7584}
7685#else
7786static
0 commit comments