From: Chris Hanson Date: Sat, 12 Jan 2019 21:03:05 +0000 (-0800) Subject: Eliminate unnecessary consing in char-set-empty?. X-Git-Tag: mit-scheme-pucked-10.1.10~6^2~33 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=73c5c94ba163dd66fd02eb9165d5667d69d53e28;p=mit-scheme.git Eliminate unnecessary consing in char-set-empty?. --- diff --git a/src/runtime/char-set.scm b/src/runtime/char-set.scm index 0f4277c2e..bca760cb0 100644 --- a/src/runtime/char-set.scm +++ b/src/runtime/char-set.scm @@ -446,6 +446,10 @@ USA. (%char-set-high char-set)))) char-sets)) +(define (char-set-empty? cs) + (and (fix:= 0 (bytevector-length (%char-set-low cs))) + (fix:= 0 (bytevector-length (%char-set-high cs))))) + (define (char-set-hash char-set) (primitive-object-hash-2 (%char-set-low char-set) (%char-set-high char-set))) @@ -458,9 +462,6 @@ USA. ranges)) (reverse! ranges)))) -(define (char-set-empty? cs) - (char-set=? (char-set) cs)) - (define (char-sets-disjoint? char-set . char-sets) (every (lambda (char-set*) (char-set-empty? (char-set-intersection char-set char-set*)))