1 ;;;; numeric things needed within the cross-compiler
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!KERNEL")
17 ;;; FIXME: This probably belongs in SB-INT instead of SB-KERNEL.
18 ;;; And couldn't it be limited to FIXNUM arguments?
19 (defun positive-primep (x)
21 "Returns T iff X is a positive prime integer."
24 (and (>= x 2) (/= x 4))
26 (not (zerop (rem x 3)))
29 (inc 2 (logxor inc 6)) ;; 2,4,2,4...
31 ((or (= r 0) (> d q)) (/= r 0))
32 (declare (fixnum inc))
33 (multiple-value-setq (q r) (truncate x d))))))