Mercurial > hg > Gears > GearsAgda
changeset 35:2bdd8e2118c7
Add tail pointer to List data segment
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 05 May 2015 21:16:04 +0900 |
parents | c3314208d7b9 |
children | 240c045ebab2 |
files | src/list/list.c src/list/listContext.h |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/list/list.c Tue May 05 18:07:12 2015 +0900 +++ b/src/list/list.c Tue May 05 21:16:04 2015 +0900 @@ -20,7 +20,7 @@ __code meta_code2(struct Context* context, enum Code next) { context->data[List]->list.head = context->data[context->dataNum]; - context->data[List]->list.current = context->data[List]->list.head; + context->data[List]->list.tail = context->data[List]->list.head; context->data[context->dataNum]->element.next = 0; goto (context->code[next])(context); } @@ -39,16 +39,13 @@ } __code meta_append(struct Context* context, enum Code next) { - if (context->data[List]->list.current->element.next) { - context->data[List]->list.current = context->data[List]->list.current->element.next; - goto meta_append(context, next); - } - context->data[List]->list.current->element.next = context->data[context->dataNum]; + context->data[List]->list.tail->element.next = context->data[context->dataNum]; + context->data[List]->list.tail = context->data[List]->list.tail->element.next; + context->data[List]->list.tail->element.next = 0; goto (context->code[next])(context); } __code append(struct Context* context) { - context->data[List]->list.current = context->data[List]->list.head; goto meta_append(context, context->data[Allocate]->allocate.after_append); }