diff --git a/include/cyclone/types.h b/include/cyclone/types.h index ed33c9a5..85477af9 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -90,6 +90,9 @@ enum object_tag { , vector_tag // 19 }; +#define type_is_pair_prim(clo) \ + (type_of(clo) >= pair_tag) + // Define the size of object tags typedef unsigned char tag_type; diff --git a/runtime.c b/runtime.c index 75ccca58..7dc02591 100644 --- a/runtime.c +++ b/runtime.c @@ -79,7 +79,7 @@ void Cyc_check_bounds(void *data, const char *label, int len, int index) /* These macros are hardcoded here to support functions in this module. */ #define closcall1(td, clo, a1) \ -if (type_of(clo) == pair_tag || prim(clo)) { \ +if (type_is_pair_prim(clo)) { \ Cyc_apply(td, 0, (closure)(a1), clo); \ } else { \ ((clo)->fn)(td, 1, clo, a1);\ @@ -96,7 +96,7 @@ if (type_of(clo) == pair_tag || prim(clo)) { \ } \ } #define closcall2(td, clo, a1, a2) \ -if (type_of(clo) == pair_tag || prim(clo)) { \ +if (type_is_pair_prim(clo)) { \ Cyc_apply(td, 1, (closure)(a1), clo,a2); \ } else { \ ((clo)->fn)(td, 2, clo, a1, a2);\ diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index de825f8c..af9cfb1a 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -160,7 +160,7 @@ (wrap (lambda (s) (if (> num-args 0) s "")))) (string-append "#define closcall" n "(td, clo" args ") \\\n" - (wrap (string-append "if (type_of(clo) == pair_tag || prim(clo)) { \\\n" + (wrap (string-append "if (type_is_pair_prim(clo)) { \\\n" " Cyc_apply(td, " n-1 ", (closure)(a1), clo" (if (> num-args 1) (substring args 3 (string-length args)) "") "); \\\n" "}")) (wrap " else { \\\n")