220 26446 <56267df5-3b8f-4139-90bd-8443cf200861@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: asorenji@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: iswalpha and locales
Date: Mon, 27 Jun 2016 21:29:35 -0700 (PDT)
Lines: 101
Approved: news@gmane.org
Message-ID: <56267df5-3b8f-4139-90bd-8443cf200861@isocpp.org>
References: <5057e854-b2ea-4c39-81c7-367bc3e54080@isocpp.org> <CANh-dXnzCJB--4vOVH0J2hPSr5N6gxvx3THtggg2Nyq4D2sZdg@mail.gmail.com> <op.yjqbf3t6hnjspo@debian>
 <1513704.D5378uGCZa@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_4875_2006955146.1467088175428"
X-Trace: ger.gmane.org 1467088199 25472 80.91.229.3 (28 Jun 2016 04:29:59 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 28 Jun 2016 04:29:59 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDSYF7ODTYPBBMH2Y65QKGQE3PB7DUA@isocpp.org Tue Jun 28 06:29:48 2016
Return-path: <std-proposals+bncBDSYF7ODTYPBBMH2Y65QKGQE3PB7DUA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f199.google.com ([209.85.220.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDSYF7ODTYPBBMH2Y65QKGQE3PB7DUA@isocpp.org>)
	id 1bHked-0007Zu-Tn
	for gclcip-std-proposals@m.gmane.org; Tue, 28 Jun 2016 06:29:44 +0200
Original-Received: by mail-qk0-f199.google.com with SMTP id r136sf14191570qke.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 27 Jun 2016 21:29:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=0PxLLBWuT9ARbQLRbqsoNsnuGsJYcFRCzVXRDT3Gjzo=;
        b=ZmlLNsw3NBNzIKY15xxna26cCoiOWpbQ6arG2o14tQIgv8hGi+M9E8LZncJJmrlxHp
         EYRdz19bm8AdnVby4YVtZINaI2TLEIfK1ihitIS55Tqo/zJTHiW+NFPMNZ8pUDfZINeO
         DNkexUcy4LgoiVrcFQwLohCWFgbOf5r/KCnUOy5K+62VzNej+BAFI86sn+oo/eIvWv1V
         BTYa7SNemZJmqybZepBVUs3yBqp0hTRqi55DnPiZcztHLgM+Wh/jzAfUnXbB9m5hzAHU
         vxbay0uGagj69gYuUrRWK45psJTofA1QtAI9xq7tMMqmt0XlwfsnKQ9k8VKnO/korRka
         Wj0g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=0PxLLBWuT9ARbQLRbqsoNsnuGsJYcFRCzVXRDT3Gjzo=;
        b=ntAm+dOxx25ug+QWqApNDjiAWZeu20bYyogtEIe36fErFBNaSICUYlVRCzaSnHt4ni
         as1Q614FRrCm+VEGEawMaafKYhVPmR1tqO/XizFWcGz4QrmSM55b4STwYIwjO3l498AH
         PCEVZoCjuOBRr0hUgy1DXf+VZaYpVDWnUhvpfAlscR2EnC7j64jejMEDdRiboHVYsSIP
         V0N9edv96EvDTxor3NdnwxE5ZjnJk13kTIabd1Hc3kPNBjoqPDcwGTWA+hGp3CStQEsL
         bAFfdVOa41z4gyUTr1LDtOxyHloJ42ZgiacSVD1ykj9VeqDlzP8YhcgrQAFEp6kJD/dS
         uCvA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=0PxLLBWuT9ARbQLRbqsoNsnuGsJYcFRCzVXRDT3Gjzo=;
        b=ahbZxePhMyWwuPV7uM0YhdJUWO4Rh6p/CBOOTPO2I4JbAkW7bKVYlcCQwgGkWYPWxj
         oM7geIi6ZtISd2WTv4vc+o0qlI9BvRIxagY+IwfRML+fs7SSoHtB8U2NMKuE2ACRfzoW
         kbE5SmPh50aS9gn6UaQ6fqrJ4/7wYcAd3qw5E9zLBwVEc9T/KVb9UXthdZreccoZydph
         0R+HjaXekiki6t0r2f2G5GfNQ6pExJuv34fjw7FmFggfjUMXwhmxP6UEYc4aCHNdKmix
         K+aj5jTZfuMM4YDS0/VHvR2K0EX9vwubmCCL0reyVDNBEuw4yZHVe/arvlHxOaNDDzGn
         KhAg==
X-Gm-Message-State: ALyK8tLz7iLlAiSGgbBJRwYn5t6KEycckMqD1Q2gvFWkFjfKDOO++Q73ey32WV/gUTcAPg==
X-Received: by 10.129.4.71 with SMTP id 68mr793456ywe.23.1467088177724;
        Mon, 27 Jun 2016 21:29:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.133.86 with SMTP id r83ls114453itd.19.gmail; Mon, 27 Jun
 2016 21:29:36 -0700 (PDT)
X-Received: by 10.36.36.133 with SMTP id f127mr21024ita.2.1467088176530;
        Mon, 27 Jun 2016 21:29:36 -0700 (PDT)
In-Reply-To: <1513704.D5378uGCZa@tjmaciei-mobl1>
X-Original-Sender: AsoRenji@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:26446
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26446>

------=_Part_4875_2006955146.1467088175428
Content-Type: multipart/alternative; 
	boundary="----=_Part_4876_711406309.1467088175428"

------=_Part_4876_711406309.1467088175428
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=B8=D0=BA, 28 =D0=B8=D1=8E=D0=BD=D1=8F 201=
6 =D0=B3., 6:39:16 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Thiago Macieira=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>
> But the same tables support the other unicode properties. There's a good=
=20
> chance that code that tests if a given codepoint is an uppercase characte=
r=20
> will check elsewhere if it's lowercase, or alphabetic.=20
>
> STL support only 12 properties=20
<http://www.cplusplus.com/reference/cwctype/iswctype/>. 12 properties, 6=20
planes with 65536 codepoints, request 12*6*65536 bits total. It's about=20
half megabyte. Not so big if you store this in some shared library. Yes,=20
it's bigger that ICU tables, but code for this table far more simple and=20
fast.

const int isalpha_offset=3D0;
const int isdigit_offset=3D1;
//...
const int isspace_offset=3D11;
const int max_offset=3D12;

bool u_isctype(char32_t c,int offset)
{
const int8_t*plane=3D[c/65536];
int offset=3D(c%65536)*max_offset+offset;
return plane?plane[offset/8]&(1<<(offset&7)):false;
}

bool u_isalpha(char32_t c){return u_isctype(isalpha_offset);}=20

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/56267df5-3b8f-4139-90bd-8443cf200861%40isocpp.or=
g.

------=_Part_4876_711406309.1467088175428
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=B8=D0=BA, 28 =D0=
=B8=D1=8E=D0=BD=D1=8F 2016 =D0=B3., 6:39:16 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=
=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Thiago Macieira =D0=BD=D0=
=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><br>But the same tables support the other unicode properties. There&#=
39;s a good=20
<br>chance that code that tests if a given codepoint is an uppercase charac=
ter=20
<br>will check elsewhere if it&#39;s lowercase, or alphabetic.
<br>
<br></blockquote><div>STL support <a href=3D"http://www.cplusplus.com/refer=
ence/cwctype/iswctype/">only 12 properties</a>. 12 properties, 6 planes wit=
h 65536 codepoints, request 12*6*65536 bits total. It&#39;s about half mega=
byte. Not so big if you store this in some shared library. Yes, it&#39;s bi=
gger that ICU tables, but code for this table far more simple and fast.<br>=
<br>const int isalpha_offset=3D0;<br>const int isdigit_offset=3D1;<br>//...=
<br>const int isspace_offset=3D11;<br>const int max_offset=3D12;<br><br>boo=
l u_isctype(char32_t c,int offset)<br>{<br>    const int8_t*plane=3D[c/6553=
6];<br>    int offset=3D(c%65536)*max_offset+offset;<br>    return plane?pl=
ane[offset/8]&amp;(1&lt;&lt;(offset&amp;7)):false;<br>}<br><br>bool u_isalp=
ha(char32_t c){return u_isctype(isalpha_offset);}=C2=A0<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/56267df5-3b8f-4139-90bd-8443cf200861%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/56267df5-3b8f-4139-90bd-8443cf200861=
%40isocpp.org</a>.<br />

------=_Part_4876_711406309.1467088175428--

------=_Part_4875_2006955146.1467088175428--

.
