From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Looking through multibyte_char_to_unibyte Date: Sun, 22 Jun 2014 20:25:38 +0300 Message-ID: <83r42gsvot.fsf@gnu.org> References: <53A70DBF.4080201@yandex.ru> <83simwsvxd.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1403457970 26802 80.91.229.3 (22 Jun 2014 17:26:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Jun 2014 17:26:10 +0000 (UTC) Cc: handa@gnu.org, emacs-devel@gnu.org To: dmantipov@yandex.ru Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 22 19:26:02 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WylWi-00065l-QN for ged-emacs-devel@m.gmane.org; Sun, 22 Jun 2014 19:26:00 +0200 Original-Received: from localhost ([::1]:49751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WylWi-0004gf-8A for ged-emacs-devel@m.gmane.org; Sun, 22 Jun 2014 13:26:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WylWb-0004gO-EG for emacs-devel@gnu.org; Sun, 22 Jun 2014 13:25:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WylWW-0005m0-3B for emacs-devel@gnu.org; Sun, 22 Jun 2014 13:25:53 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:59826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WylWV-0005lm-Qs; Sun, 22 Jun 2014 13:25:48 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0N7K00B00YZATF00@a-mtaout21.012.net.il>; Sun, 22 Jun 2014 20:25:46 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N7K00BFEZ2WTJ00@a-mtaout21.012.net.il>; Sun, 22 Jun 2014 20:25:45 +0300 (IDT) In-reply-to: <83simwsvxd.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:172633 Archived-At: > Date: Sun, 22 Jun 2014 20:20:30 +0300 > From: Eli Zaretskii > Cc: handa@gnu.org, emacs-devel@gnu.org > > > Date: Sun, 22 Jun 2014 21:09:19 +0400 > > From: Dmitry Antipov > > Cc: Kenichi Handa > > > > int > > multibyte_char_to_unibyte (int c) > > { > > if (c < 0x80) > > return c; > > if (((c) > 0x3FFF7F)) > > return (((c) > 0x3FFF7F) ? (c) - 0x3FFF00 : multibyte_char_to_unibyte (c)); > > return (c & 0xFF); > > } > > > > Is this a subtle trick which I just can't understand and explain, or something > > is really wrong with this? > > What do you think this function intends to do? IOW, how would you go > about "converting a multibyte character to unibyte", something that is > not possible in principle? Wait, you probably asked about the recursive call to multibyte_char_to_unibyte, is that right? If so, that branch is never taken, and will be optimized away by any reasonable compiler.