From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Lars J. Aas" Newsgroups: gmane.lisp.guile.devel Subject: Re: Guile 1.5.8 beta available for testing. Date: Mon, 2 Sep 2002 13:38:18 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <20020902113818.GA24865@sim.no> References: <87adn9plqf.fsf@raven.i.defaultvalue.org> <20020827090636.GA12973@sim.no> <87y9arymk6.fsf@zagadka.ping.de> <20020829075923.GB19307@sim.no> <87d6rzme3x.fsf@zagadka.ping.de> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1030966657 334 127.0.0.1 (2 Sep 2002 11:37:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Sep 2002 11:37:37 +0000 (UTC) Cc: guile-devel@gnu.org, guile-user@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17lpWR-00005H-00 for ; Mon, 02 Sep 2002 13:37:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17lpXt-00023B-00; Mon, 02 Sep 2002 07:39:05 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17lpXD-00022l-00 for guile-devel@gnu.org; Mon, 02 Sep 2002 07:38:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17lpXB-00022M-00 for guile-devel@gnu.org; Mon, 02 Sep 2002 07:38:22 -0400 Original-Received: from trh.sim.no ([213.236.166.75] helo=sim.no) by monty-python.gnu.org with smtp (Exim 4.10) id 17lpXA-00022E-00 for guile-devel@gnu.org; Mon, 02 Sep 2002 07:38:20 -0400 Original-Received: (qmail 25697 invoked by uid 2000); 2 Sep 2002 11:38:18 -0000 Original-To: Marius Vollmer Content-Disposition: inline In-Reply-To: <87d6rzme3x.fsf@zagadka.ping.de> User-Agent: Mutt/1.3.24i Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1222 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1222 Marius Vollmer wrote: : "Lars J. Aas" writes: : : > : A fix would be to move the scm_t_signed_bits cast one level up, and : > : also in SCM_MOST_NEGATIVE_FIXNUM. We should do that and put a : > : deriding comment about MS on the code. OK? : > : > Sounds reasonable. : : However, in CVS HEAD, we use these definitions, to make them : computable by the preprocessor: : : #define SCM_I_FIXNUM_BIT (SCM_LONG_BIT - 2) : #define SCM_MOST_POSITIVE_FIXNUM ((SCM_T_SIGNED_BITS_MAX-3)/4) : #define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1) : : Does this work as well? Yes, the following snippet works out of the box with no tweaks necessary for the defines. Lars J ---------------------------------------------------------------------------- #include #include typedef signed long scm_t_signed_bits; #ifdef LONG_BIT # define SCM_LONG_BIT LONG_BIT #else # define SCM_LONG_BIT (SCM_CHAR_BIT * sizeof (long) / sizeof (char)) #endif #define SCM_T_SIGNED_BITS_MAX LONG_MAX #define SCM_I_FIXNUM_BIT (SCM_LONG_BIT - 2) #define SCM_MOST_POSITIVE_FIXNUM ((SCM_T_SIGNED_BITS_MAX-3)/4) #define SCM_MOST_NEGATIVE_FIXNUM (-SCM_MOST_POSITIVE_FIXNUM-1) #define SCM_POSFIXABLE(n) ((n) <= SCM_MOST_POSITIVE_FIXNUM) int main(int argc, char ** argv) { int val; fprintf(stderr, "test 1 - "); if ( SCM_POSFIXABLE(-1) ) fprintf(stderr, "success\n"); else fprintf(stderr, "failure\n"); fprintf(stderr, "test 2 - "); val = -1; if ( SCM_POSFIXABLE(val) ) fprintf(stderr, "success\n"); else fprintf(stderr, "failure\n"); return 0; } _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel