From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: 1+ and 1- in C Date: Mon, 11 Apr 2005 08:17:00 +1000 Message-ID: <87is2uuvj7.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1113171459 28780 80.91.229.2 (10 Apr 2005 22:17:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2005 22:17:39 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Apr 11 00:17:37 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DKkjn-0003sj-Eq for guile-devel@m.gmane.org; Mon, 11 Apr 2005 00:17:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DKkJm-00043j-Jy for guile-devel@m.gmane.org; Sun, 10 Apr 2005 17:50:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DKkJT-0003xL-1l for guile-devel@gnu.org; Sun, 10 Apr 2005 17:49:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DKkJO-0003tc-9J for guile-devel@gnu.org; Sun, 10 Apr 2005 17:49:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DKkJM-0003nI-SO for guile-devel@gnu.org; Sun, 10 Apr 2005 17:49:44 -0400 Original-Received: from [61.8.0.84] (helo=mailout1.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DKklL-0005Oq-CE for guile-devel@gnu.org; Sun, 10 Apr 2005 18:18:39 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87]) by mailout1.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j3AMH8Ju010285 for ; Mon, 11 Apr 2005 08:17:08 +1000 Original-Received: from localhost (ppp2445.dyn.pacific.net.au [61.8.36.69]) by mailproxy2.pacific.net.au (8.12.3/8.12.3/Debian-7.1) with ESMTP id j3AMH70H030571 for ; Mon, 11 Apr 2005 08:17:07 +1000 Original-Received: from gg by localhost with local (Exim 3.36 #1 (Debian)) id 1DKkjk-0000jV-00; Mon, 11 Apr 2005 08:17:00 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:4894 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4894 --=-=-= I propose to do 1+ and 1- in C so they're as fast as plain + and -. Calling scm_sum and scm_difference will still get goops/generics dispatch the same as the scheme code, if I'm not mistaken. --=-=-= Content-Disposition: inline; filename=numbers.c.oneplus.diff --- numbers.c.~1.277.~ 2005-03-13 11:17:05.000000000 +1100 +++ numbers.c 2005-04-10 09:31:40.000000000 +1000 @@ -4107,6 +4107,16 @@ } +SCM_DEFINE (scm_oneplus, "1+", 1, 0, 0, + (SCM x), + "Return @math{@var{x}+1}.") +#define FUNC_NAME s_scm_oneplus +{ + return scm_sum (x, SCM_I_MAKINUM (1)); +} +#undef FUNC_NAME + + SCM_GPROC1 (s_difference, "-", scm_tc7_asubr, scm_difference, g_difference); /* If called with one argument @var{z1}, -@var{z1} returned. Otherwise * the sum of all but the first argument are subtracted from the first @@ -4342,6 +4352,16 @@ #undef FUNC_NAME +SCM_DEFINE (scm_oneminus, "1-", 1, 0, 0, + (SCM x), + "Return @math{@var{x}-1}.") +#define FUNC_NAME s_scm_oneminus +{ + return scm_difference (x, SCM_I_MAKINUM (1)); +} +#undef FUNC_NAME + + SCM_GPROC1 (s_product, "*", scm_tc7_asubr, scm_product, g_product); /* "Return the product of all arguments. If called without arguments,\n" * "1 is returned." --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --=-=-=--