Changeset 4730


Ignore:
Timestamp:
11/14/03 01:16:52 (18 years ago)
Author:
piso
Message:

nreverse(): optimization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Cons.java

    r4726 r4730  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Cons.java,v 1.31 2003-11-14 00:53:06 piso Exp $
     5 * $Id: Cons.java,v 1.32 2003-11-14 01:16:52 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    190190    public final LispObject nreverse() throws ConditionThrowable
    191191    {
    192         // Following code is from CLISP.
     192        // Following code is adapted from CLISP.
    193193        LispObject list3 = cdr;
    194194        if (list3 instanceof Cons) {
    195             if (list3.cdr() instanceof Cons) {
    196                 LispObject list1 = list3;
     195            if (((Cons)list3).cdr instanceof Cons) {
     196                Cons list1 = (Cons) list3;
    197197                LispObject list2 = NIL;
    198198                do {
    199                     LispObject h = list3.cdr();
    200                     list3.setCdr(list2);
     199                    LispObject h = ((Cons)list3).cdr;
     200                    ((Cons)list3).cdr = list2;
    201201                    list2 = list3;
    202202                    list3 = h;
    203                 } while (list3.cdr() instanceof Cons);
     203                } while (((Cons)list3).cdr instanceof Cons);
    204204                cdr = list2;
    205                 list1.setCdr(list3);
    206             }
    207             LispObject h = this.car();
     205                list1.cdr = list3;
     206            }
     207            LispObject h = car;
    208208            car = list3.car();
    209209            list3.setCar(h);
Note: See TracChangeset for help on using the changeset viewer.