From owner-svn-src-all@FreeBSD.ORG Sun Sep 28 00:57:48 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0350B807; Sun, 28 Sep 2014 00:57:48 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id B6F1496E; Sun, 28 Sep 2014 00:57:47 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id BA848780FD8; Sun, 28 Sep 2014 10:30:40 +1000 (EST) Date: Sun, 28 Sep 2014 10:30:39 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Sean Bruno Subject: Re: svn commit: r272210 - head/games/factor In-Reply-To: <201409271057.s8RAvYdF086338@svn.freebsd.org> Message-ID: <20140928101352.C927@besplex.bde.org> References: <201409271057.s8RAvYdF086338@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=FhmKRLTLOMscdICiqboA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Sep 2014 00:57:48 -0000 On Sat, 27 Sep 2014, Sean Bruno wrote: > Log: > Update factor for changes to types in primes, which is a dependency. > > Fixes build-fail on mips32 introduced at 272207. > > Modified: > head/games/factor/factor.c > > Modified: head/games/factor/factor.c > ============================================================================== > --- head/games/factor/factor.c Sat Sep 27 09:57:34 2014 (r272209) > +++ head/games/factor/factor.c Sat Sep 27 10:57:34 2014 (r272210) > @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include Needed only for the style bugs below. > #include > #include > #include > @@ -227,7 +228,7 @@ pr_fact(BIGNUM *val) > > /* Divide factor out until none are left. */ > do { > - printf(hflag ? " 0x%lx" : " %lu", *fact); > + printf(hflag ? " 0x%" PRIx64 "" : " %" PRIu64 "", *fact); This has the same PRI* ugliness as primes.c, but doesn't break the output format for the hex case (it still has the "0x" prefix). > BN_div_word(val, (BN_ULONG)*fact); > } while (BN_mod_word(val, (BN_ULONG)*fact) == 0); However, it seems to need much larger changes to keep up. Its BN and BIGNUMS aren't actually (arbitrary-precision) bignums. BIGNUM is just ubig, which is now uint64_t. BN_ULONG is still just u_long. Parsing functions still use just strtoul() to create BIGNUMs. Now they can't even create the non-bignums given by BIGNUM == ubig on 32-bit systems. So if there are no other bugs, factor(6) is probably limited to UINT32_MAX on 32-bit system and to the new limit SIEVE_MAX on 64-bit systems (like the previous version of primes(6)). Its documentation doesn't seem to have been changed. Its old documentation gives the wrong limit of UINT64_MAX (expressed unreadably in decimal) on 64-bit systems. Bruce