220 26405 <e9664260-5d43-4630-b2a5-1c9baea57cbd@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: Sun, 26 Jun 2016 07:03:01 -0700 (PDT)
Lines: 115
Approved: news@gmane.org
Message-ID: <e9664260-5d43-4630-b2a5-1c9baea57cbd@isocpp.org>
References: <5057e854-b2ea-4c39-81c7-367bc3e54080@isocpp.org>
 <84d2b9e6-a29b-4c79-8646-2f00dbc5087b@isocpp.org> <f8ce2288-8e06-41ad-8e58-0082d9d9982a@isocpp.org>
 <1550791.ovymrLsGO4@tjmaciei-mobl1>
 <CANh-dXmGSdNaEZZ2qY9-L6VkR52sNfVOKHMtkgDpOMgcWtO6Gw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3375_370609748.1466949781613"
X-Trace: ger.gmane.org 1466949790 9657 80.91.229.3 (26 Jun 2016 14:03:10 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 26 Jun 2016 14:03:10 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDSYF7ODTYPBBFWBX65QKGQEIPU25CI@isocpp.org Sun Jun 26 16:03:05 2016
Return-path: <std-proposals+bncBDSYF7ODTYPBBFWBX65QKGQEIPU25CI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f200.google.com ([209.85.192.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDSYF7ODTYPBBFWBX65QKGQEIPU25CI@isocpp.org>)
	id 1bHAeO-0002e6-T2
	for gclcip-std-proposals@m.gmane.org; Sun, 26 Jun 2016 16:03:05 +0200
Original-Received: by mail-pf0-f200.google.com with SMTP id g62sf346670147pfb.3
        for <gclcip-std-proposals@m.gmane.org>; Sun, 26 Jun 2016 07:03:04 -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=Nsj/s80myKfuce/SPuwXErs/ck5azQZ4+uD+zMVnKMo=;
        b=m3oCrLOUCuQmATr59ZmIK1aDIemkNnCZByvMhS+nG9tOhsrfu3Ey/rVSwsVw2FZdu6
         QEWOv+v3njURVA4AEPilz6gpfiYr95p6k9s1OdZx4JmHsFFfGNvcJOYsNuAFzSk/C4rV
         4Y/b6cswv//lfly3RFUx7bkyaK6zlpZCSptE6+jvvfzs4iJOfUtuF6exECQ1wVQvtZwJ
         0UuuIo100aVvYmcTyApWE1SBnjuyXaG7+lgEb8F7uqt4CCgcW2xxlg06pSNtiVNN39tp
         qODUCurIJdt705Ele/pSM3jXLooI/ahGhw5/0lwGsgczoj8ZxEqL1Qy6sQwaHshlI9wJ
         PSWQ==
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=Nsj/s80myKfuce/SPuwXErs/ck5azQZ4+uD+zMVnKMo=;
        b=jTmKXEZ530Uvz4nJYFgOzGTnjeqpgY6ZcY5h4Zy0ggfBwcfJSqRFo7A/6aT6sVcrCX
         zct3gV4h01B9YgbOmU4X70bvJzlwt0lGaglnUV29pcpukETeygx7NSzpPRS7V2Jcj+wR
         xkxG9lUvS5wFmqmCFqOqzkH2tZ36yyRJIGwIPUu7Gfb1RmmC3ICuunWdKY8zXXopH9+G
         rh8we0jMiEeQsOQoYJR712gsMPCBNbmJCf7fRckRU8zntnGSQdhI6cp8mbSNm2Qee+F1
         +L4UYn9CBIaPSND6BnXkF3tn24jEKfV7/w5NXrLzSdRKNX8zroMthDyuOLTBJyuvue8x
         osRA==
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=Nsj/s80myKfuce/SPuwXErs/ck5azQZ4+uD+zMVnKMo=;
        b=Ql6FgF6/zLNxmTGU2xEOQKTz0R2fOKzqcQwHCB+qyQySsAdiLgEphHcx1EceRv0e7a
         4ZTo1cG4EwmFOAieVvvd4ZjJ6HBQvhiYBOq6+1zddCBzNhccyJ7tTWz3I3Xh6ZO60iXV
         Lr/5m/3pkgBV+vA9Ys+tf3IAMh5HL1vKrfdpq3ZOopqpd8AgtJE2QRyhTKkEzVptIWAQ
         qJSegc9kp2uRF3/Jx2h4ihJzK15hhG3YDb6kj4HftB2Tiprx52CmPxBdQ/v5dOnrnmLo
         /z0I5/m5EEkRNGzpbJOR60bd6Jj1Td2dai3JNCExEY9mwDtlv6O9m8lX6bGvskM2pgZl
         OFLA==
X-Gm-Message-State: ALyK8tLWhz8oPt2/AOGkcQwupLIOPhyyTIf1w23IUjRYF2cgDNhj0xpG5NVGebbgAga1Xg==
X-Received: by 10.66.43.41 with SMTP id t9mr12756466pal.12.1466949783768;
        Sun, 26 Jun 2016 07:03:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.169.200 with SMTP id f69ls3192255ioj.100.gmail; Sun, 26
 Jun 2016 07:03:02 -0700 (PDT)
X-Received: by 10.36.1.15 with SMTP id 15mr155095itk.6.1466949782603;
        Sun, 26 Jun 2016 07:03:02 -0700 (PDT)
In-Reply-To: <CANh-dXmGSdNaEZZ2qY9-L6VkR52sNfVOKHMtkgDpOMgcWtO6Gw@mail.gmail.com>
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:26405
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26405>

------=_Part_3375_370609748.1466949781613
Content-Type: multipart/alternative; 
	boundary="----=_Part_3376_1237938054.1466949781613"

------=_Part_3376_1237938054.1466949781613
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=D0=BD=D1=8C=D0=B5, 26 =D0=
=B8=D1=8E=D0=BD=D1=8F 2016 =D0=B3., 11:28:35 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 Jeffrey Yasskin=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>
> ICU does have ways to subset its data tables to include only the parts=20
> you use. The proposal author should probably validate that to show us=20
> what kinds of subsets are already possible, but it'll also be possible=20
> to add new subsets if the C++ library wants to make finer-grained=20
> distinctions.=20
>
> Okay, lets use subset model. Unicode use 273 unicode blocks, 271792 codes=
=20
total <https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview>. We can=20
write something like this:
struct u32_subset
{
    int32_t lower_bound,size;
    const int8_t*table;
    bool operator<(int32_t code)const{return lower_bound<code;}
};
bool isu32alpha(int32_t code)
{
    static const u32_subset unicode_blocks[273]=3D{/*some large table*/};

    const=20
u32_subset&subset=3D*std::lower_bound(unicode_blocks,unicode_blocks+273,cod=
e);
    size_t offset=3Dcode-subset.lower_bound;
    return offset<subset.size?subset.table[offset/8]&(1<<(offset&7)):false;
}

u32_subset request 4 byte for lower_bound, 4 byte for size, and 8 bytes for=
=20
table pointer. 273*16=3D4368 bytes total.
All 273 tables request 271792 bites, or 33974 bytes total.
4368+33974=3D38342 bytes total.
38 KB is still very big and your 4+ GB desktop can't afford this?

--=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/e9664260-5d43-4630-b2a5-1c9baea57cbd%40isocpp.or=
g.

------=_Part_3376_1237938054.1466949781613
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>=D0=B2=D0=BE=D1=81=D0=BA=D1=80=D0=B5=D1=81=D0=B5=
=D0=BD=D1=8C=D0=B5, 26 =D0=B8=D1=8E=D0=BD=D1=8F 2016 =D0=B3., 11:28:35 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 =
Jeffrey Yasskin =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #c=
cc solid;padding-left: 1ex;"><br>ICU does have ways to subset its data tabl=
es to include only the parts
<br>you use. The proposal author should probably validate that to show us
<br>what kinds of subsets are already possible, but it&#39;ll also be possi=
ble
<br>to add new subsets if the C++ library wants to make finer-grained
<br>distinctions.
<br>
<br></blockquote><div>Okay, lets use subset model. Unicode use 273 unicode =
blocks, <a href=3D"https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview">=
271792 codes total</a>. We can write something like this:</div><div>struct=
=C2=A0u32_subset<br>{</div><div>=C2=A0 =C2=A0 int32_t=C2=A0lower_bound,size=
;</div><div>=C2=A0 =C2=A0 const int8_t*table;</div><div>=C2=A0 =C2=A0 bool =
operator&lt;(int32_t code)const{return lower_bound&lt;code;}<br>};<br></div=
><div>bool isu32alpha(int32_t code)<br>{</div><div>=C2=A0 =C2=A0 static con=
st u32_subset unicode_blocks[273]=3D{/*some large table*/};</div><div><br><=
/div><div>=C2=A0 =C2=A0 const u32_subset&amp;subset=3D*std::lower_bound(uni=
code_blocks,unicode_blocks+273,code);</div><div>=C2=A0 =C2=A0 size_t offset=
=3Dcode-subset.lower_bound;</div><div>=C2=A0 =C2=A0 return offset&lt;subset=
..size?subset.table[offset/8]&amp;(1&lt;&lt;(offset&amp;7)):false;<br>}<br><=
/div><div><br></div><div>u32_subset request 4 byte for=C2=A0lower_bound, 4 =
byte for size, and 8 bytes for table pointer. 273*16=3D4368 bytes total.</d=
iv><div>All 273 tables request 271792 bites, or 33974 bytes total.</div><di=
v>4368+33974=3D38342 bytes total.</div><div>38 KB is still very big and you=
r 4+ GB desktop can&#39;t afford this?</div><div><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/e9664260-5d43-4630-b2a5-1c9baea57cbd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e9664260-5d43-4630-b2a5-1c9baea57cbd=
%40isocpp.org</a>.<br />

------=_Part_3376_1237938054.1466949781613--

------=_Part_3375_370609748.1466949781613--

.
