Ignore:
Timestamp:
Apr 7, 2017, 2:32:03 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
3a48e283
Parents:
4cfcf41
Message:

Expand benchmarks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/cfa-stack.c

    r4cfcf41 r122aecd  
    88
    99forall(otype T) void ?{}(stack(T)* s) {
    10         ?{}( &s->head, 0 );
     10        (&s->head){ 0 };
     11}
     12
     13forall(otype T) void ?{}(stack(T)* s, stack(T) t) {
     14        stack_node(T)** crnt = &s->head;
     15        stack_node(T)* next = t.head;
     16        while ( next ) {
     17                *crnt = ((stack_node(T)*)malloc()){ next->value };
     18                stack_node(T)* acrnt = *crnt;
     19                crnt = &acrnt->next;
     20                next = next->next;
     21        }
     22        *crnt = 0;
     23}
     24
     25forall(otype T) stack(T) ?=?(stack(T)* s, stack(T) t) {
     26        if ( s->head == t.head ) return *s;
     27        clear(s);
     28        s{ t };
     29        return *s;
    1130}
    1231
    1332forall(otype T) void ^?{}(stack(T)* s) {
    14         stack_node(T)* next = s->head;
    15         while ( next ) {
    16                 stack_node(T)* crnt = next;
    17                 next = crnt->next;
    18                 delete(crnt);
    19         }
     33        clear(s);
    2034}
    2135
     
    3549        return x;
    3650}
     51
     52forall(otype T) void clear(stack(T)* s) {
     53        stack_node(T)* next = s->head;
     54        while ( next ) {
     55                stack_node(T)* crnt = next;
     56                next = crnt->next;
     57                delete(crnt);
     58        }
     59}
Note: See TracChangeset for help on using the changeset viewer.