mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
index checks fix
This commit is contained in:
parent
b198e11416
commit
b52a7fcb29
3 changed files with 27 additions and 23 deletions
|
|
@ -424,19 +424,20 @@ void run(bytefile *bf, int argc, char **argv) {
|
|||
case CMD_BUILTIN_Barray: { // CALL Barray %d
|
||||
size_t elem_count = ip_read_int(&s.ip);
|
||||
|
||||
// void **opr_buffer = elem_count > BUFFER_SIZE
|
||||
// ? alloc(elem_count * sizeof(void *))
|
||||
// : buffer;
|
||||
// for (size_t i = 0; i < elem_count; ++i) {
|
||||
// opr_buffer[elem_count - i - 1] = s_pop();
|
||||
// }
|
||||
void **opr_buffer = elem_count > BUFFER_SIZE
|
||||
? alloc(elem_count * sizeof(void *))
|
||||
: buffer;
|
||||
for (size_t i = 0; i < elem_count; ++i) {
|
||||
opr_buffer[elem_count - i - 1] = s_pop();
|
||||
}
|
||||
|
||||
s_rotate_n(elem_count);
|
||||
// void *array =
|
||||
// Barray((aint *)opr_buffer,
|
||||
// BOX(elem_count)); // NOTE: not shure if elems should be
|
||||
// added
|
||||
void *array = Barray((aint *)s_peek(), BOX(elem_count));
|
||||
// s_rotate_n(elem_count);
|
||||
void *array =
|
||||
Barray((aint *)opr_buffer,
|
||||
BOX(elem_count)); // NOTE: not shure if elems should be
|
||||
// added
|
||||
|
||||
// void *array = Barray((aint *)s_peek(), BOX(elem_count));
|
||||
s_push(array);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue