svn commit: r272207 - in head/games: factor primes

John Baldwin jhb at freebsd.org
Sat Sep 27 12:55:32 UTC 2014


On Saturday, September 27, 2014 09:00:39 AM Colin Percival wrote:
> Author: cperciva
> Date: Sat Sep 27 09:00:38 2014
> New Revision: 272207
> URL: http://svnweb.freebsd.org/changeset/base/272207
> 
> Log:
>   Switch primes(6) from using unsigned long to using uint64_t.  This fixes
>   'limited range of type' warnings about comparisons on 32-bit systems, and
>   allows 32-bit systems to compute the full range of primes.
> 
> Modified:
>   head/games/factor/factor.6
>   head/games/primes/primes.c
>   head/games/primes/primes.h
> 
> Modified: head/games/primes/primes.h
> ============================================================================
> == --- head/games/primes/primes.h	Sat Sep 27 08:59:43 2014	(r272206)
> +++ head/games/primes/primes.h	Sat Sep 27 09:00:38 2014	(r272207)
> @@ -41,8 +41,10 @@
>   * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
>   */
> 
> +#include <stdint.h>
> +
>  /* ubig is the type that holds a large unsigned value */
> -typedef unsigned long ubig;		/* must be >=32 bit unsigned value */
> +typedef uint64_t ubig;			/* must be >=32 bit unsigned value */
>  #define	BIG		ULONG_MAX	/* largest value will sieve */

Should this be UINT64_MAX (or however that is spelled) instead of ULONG_MAX 
now?  (or is it even still used?  I know your change removed its use in at 
least one place.)

-- 
John Baldwin


More information about the svn-src-all mailing list