better isCallable

This commit is contained in:
dzaima 2025-01-17 21:51:46 +02:00
parent 8b0d0399e4
commit 196cc07454
2 changed files with 3 additions and 1 deletions

View File

@ -456,7 +456,7 @@ FORCE_INLINE bool isF64(B x) { return (x.u<<1) - ((0xFFEull<<52) + 2) >= (1ull<<
FORCE_INLINE bool isNum(B x) { return isF64(x); }
FORCE_INLINE bool isAtm(B x) { return !isArr(x); }
FORCE_INLINE bool isCallable(B x) { return isMd(x) | isFun(x); }
FORCE_INLINE bool isCallable(B x) { u16 tag = x.u>>48; return tag>=MD1_TAG && tag<=FUN_TAG; }
FORCE_INLINE bool isPrim(B x) { return isCallable(x) && RTID(x)!=RTID_NONE; }

View File

@ -859,6 +859,8 @@ void base_init() { // very first init function
// making sure that expected properties of constants hold
assert((MD1_TAG>>1) == (MD2_TAG>>1)); // dependencies: isMd
assert(MD1_TAG+1 == MD2_TAG); // dependencies: isCallable
assert(MD2_TAG+1 == FUN_TAG); // dependencies: isCallable
// dependencies: v_tagCheck & the JIT equivalent
assert(v_bad17_read == (bi_noVar.u >>47));