Skip to content

Commit ee2a21f

Browse files
committed
support and use fixnum-for-every-platform?
1 parent cb2478f commit ee2a21f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@
741741
[exact? (make-pred-ty -ExactNumber)]
742742
[inexact? (make-pred-ty (Un -InexactReal -InexactImaginary -InexactComplex))]
743743
[fixnum? (make-pred-ty -Fixnum)]
744+
[fixnum-for-every-system? (asym-pred Univ B (-PS (-is-type 0 -Fixnum) -tt))]
744745
[index? (make-pred-ty -Index)]
745746
[positive? (-> -Real B : (-PS (-is-type 0 -PosReal) (-is-type 0 -NonPosReal)))]
746747
[negative? (-> -Real B : (-PS (-is-type 0 -NegReal) (-is-type 0 -NonNegReal)))]

typed-racket-lib/typed-racket/rep/numeric-base-types.rkt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
(rep rep-utils base-type-rep type-mask core-rep)
99
(types numeric-predicates)
1010
racket/unsafe/ops
11+
racket/fixnum
1112
;; For base type contracts
1213
(for-template racket/base racket/contract/base (types numeric-predicates)))
1314

@@ -21,15 +22,12 @@
2122
nbits-union
2223
nbits-subtract)
2324

24-
;; Is the number a fixnum on *all* the platforms Racket supports? This
25-
;; works because Racket compiles only on 32+ bit systems. This check is
25+
;; Is the number a fixnum on *all* the platforms Racket supports? This check is
2626
;; done at compile time to typecheck literals -- so use it instead of
2727
;; `fixnum?' to avoid creating platform-dependent .zo files.
2828
(define (portable-fixnum? n)
29-
(and (exact-integer? n)
30-
(< n (expt 2 30))
31-
(>= n (- (expt 2 30)))))
32-
;; same, for indexes
29+
(fixnum-for-every-system? n))
30+
;; same, for indexes; Racket compiles only on 32+ bit systems
3331
(define (portable-index? n)
3432
(and (exact-integer? n)
3533
(< n (expt 2 28))

0 commit comments

Comments
 (0)