From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: Proposal: block-based vector allocator Date: Mon, 21 May 2012 17:07:48 +0200 Message-ID: References: <4EDDA68B.5050601@yandex.ru> <4FB4AFA4.7020601@yandex.ru> <4FBA32D9.5090704@yandex.ru> <4FBA47A0.4050103@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1337612888 26454 80.91.229.3 (21 May 2012 15:08:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 21 May 2012 15:08:08 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Dmitry Antipov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 21 17:08:05 2012 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 1SWUDL-0006DK-TW for ged-emacs-devel@m.gmane.org; Mon, 21 May 2012 17:08:04 +0200 Original-Received: from localhost ([::1]:57233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWUDL-0002AB-AT for ged-emacs-devel@m.gmane.org; Mon, 21 May 2012 11:08:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWUDF-00029P-Em for emacs-devel@gnu.org; Mon, 21 May 2012 11:08:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWUDB-0007Bs-LD for emacs-devel@gnu.org; Mon, 21 May 2012 11:07:57 -0400 Original-Received: from mail-out.m-online.net ([212.18.0.9]:46520) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWUDB-0007Be-Fj for emacs-devel@gnu.org; Mon, 21 May 2012 11:07:53 -0400 Original-Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3Vx3JR3lQsz4Kh0m; Mon, 21 May 2012 17:07:50 +0200 (CEST) Original-Received: from igel.home (ppp-88-217-114-7.dynamic.mnet-online.de [88.217.114.7]) by mail.mnet-online.de (Postfix) with ESMTPA id 3Vx3JQ3Knkz4KKJd; Mon, 21 May 2012 17:07:50 +0200 (CEST) Original-Received: by igel.home (Postfix, from userid 501) id DC4C8CA2A4; Mon, 21 May 2012 17:07:48 +0200 (CEST) X-Yow: Are you mentally here at Pizza Hut?? In-Reply-To: <4FBA47A0.4050103@yandex.ru> (Dmitry Antipov's message of "Mon, 21 May 2012 17:48:16 +0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 212.18.0.9 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:150579 Archived-At: Dmitry Antipov writes: > On 05/21/2012 05:02 PM, Andreas Schwab wrote: > >> It doesn't make much sense to try to find such a trivial but non-std >> macro in a system header. > > Hm, glibc provides some not-so-trivial bits (assuming gcc): > > # define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ > ? (((x) + (y) - 1) & ~((y) - 1)) \ > : ((((x) + ((y) - 1)) / (y)) * (y))) > > It seems to be a very negligible optimization, but why not use it if available? Since you are always using a constant you can define your roundup macro accordingly. But note that the expansion is buggy for some types of arguments, so one more reason not to use it. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."