Skip to content

Commit 1a0aa64

Browse files
committed
Parse floats up to 64b
1 parent 3b1078b commit 1a0aa64

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/libAtomVM/opcodesswitch.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,14 @@ typedef dreg_t dreg_gc_safe_t;
235235
case COMPACT_NBITS_VALUE:{ \
236236
int sz = (first_byte >> 5) + 2; \
237237
if (UNLIKELY(sz > 8)) { \
238-
/* TODO: when first_byte >> 5 is 7, a different encoding is used */ \
239-
fprintf(stderr, "Unexpected nbits vaue @ %" PRIuPTR "\n", (uintptr_t) ((decode_pc) - 1)); \
240-
AVM_ABORT(); \
241-
break; \
238+
sz = *(decode_pc) + 9; \
239+
(decode_pc)++; \
240+
/* Integer larger than 60-bits but no bigger than 64-bits */ \
241+
/* will become boxed term taking 9 bytes (1 byte box + 64 bits)*/ \
242+
/* AtomVM can handle 64 bit int, but not larger ones until BigNum support is ready*/ \
243+
if (sz > 9 && (first_byte & 0xF) == COMPACT_LARGE_INTEGER) { \
244+
fprintf(stderr, "WARNING: Loading integer possibly longer than 64 bits"); \
245+
} \
242246
} \
243247
(decode_pc) += sz; \
244248
break; \

0 commit comments

Comments
 (0)