diff options
author | dzaima <dzaimagit@gmail.com> | 2024-02-16 03:36:43 +0200 |
---|---|---|
committer | dzaima <dzaimagit@gmail.com> | 2024-02-16 03:36:49 +0200 |
commit | 8d427100c2d6ed39200755bac0edf4281d44e41a (patch) | |
tree | 0d7898e23378d2af9c58e993245f48b18b1e119e | |
parent | 5df8c4dbd15910d0e2b94a97c7f82df6b57cfeff (diff) |
FFI: fix calculated memory size of atom:b
-rw-r--r-- | src/ffi.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1012,13 +1012,14 @@ BQNFFIEnt ffi_parseDecoratedType(B arg, bool forRes) { static u64 calcAtomSize(B chr) { return styG(chr)==sty_a? sizeof(BQNV) : sizeof(ffi_arg)>8? sizeof(ffi_arg) : 8; } +static u64 calcMemSize(B o); static NOINLINE u64 calcMemSizeCompound(B o) { BQNFFIType* t = c(BQNFFIType, o); if (t->ty==cty_ptr || t->ty==cty_tlarr) return sizeof(void*); // *any / &any / top-level [n]any else if (t->ty==cty_struct || t->ty==cty_starr) return t->structSize; // {...} else if (t->ty==cty_repr) { // any:any B o2 = t->a[0].o; - if (isC32(o2)) return calcAtomSize(o2); + if (isC32(o2)) return calcMemSize(o2); if (c(BQNFFIType,o2)->ty != cty_ptr) thrM("FFI: Bad type with reinterpretation"); return sizeof(void*); } else thrM("FFI: Unimplemented type (size calculation)"); |