Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@
(-> -NonPosInt -Int -NonPosFixnum)
(binop -Int -Fixnum))))

(define fxpopcount-type
(lambda ()
(fx-from-cases
(-Nat . -> . -NonNegFixnum)
(-NonNegFixnum . -> . -NonNegFixnum)
(-Int . -> . -Fixnum))))

;; A bit of machinery to allow floating point operations to be abstracted over double/extended
;; floating point types without repetition.
(define-syntax (define-fl-type-lambda stx)
Expand Down Expand Up @@ -1946,6 +1953,10 @@
[fxlshift (fxlshift-type)]
[fxrshift (fxrshift-type)]

[fxpopcount (fxpopcount-type)]
[fxpopcount16 (fxpopcount-type)]
[fxpopcount32 (fxpopcount-type)]

[fx= (fx=-type)]
[fx< (fx<-type)]
[fx> (fx>-type)]
Expand Down
3 changes: 3 additions & 0 deletions typed-racket-test/succeed/fixnum.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@
(check equal? (fxmin 3 2) 2)
(check equal? (fxmax 3 4) 4)

(check equal? (fxpopcount #x0fffffffffffffff) 60)
(check equal? (fxpopcount32 #xffffffff) 32)
(check equal? (fxpopcount16 #xffff) 16)
Loading