Changeset 4790


Ignore:
Timestamp:
11/16/03 18:29:19 (18 years ago)
Author:
piso
Message:

truncate(): setValues().

Location:
trunk/j/src/org/armedbear/lisp
Files:
3 edited

Legend:

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

    r4586 r4790  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Bignum.java,v 1.47 2003-10-30 21:40:10 asimon Exp $
     5 * $Id: Bignum.java,v 1.48 2003-11-16 18:24:54 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    371371    {
    372372        final LispThread thread = LispThread.currentThread();
    373         LispObject[] values = new LispObject[2];
     373        LispObject value1, value2;
    374374  try {
    375375    if (obj instanceof Ratio) {
     
    379379            LispObject remainder =
    380380        subtract(quotient.multiplyBy(divisor));
    381             values[0] = quotient;
    382             values[1] = remainder;
     381            value1 = quotient;
     382            value2 = remainder;
    383383    } else if (obj instanceof Fixnum) {
    384384            BigInteger divisor = ((Fixnum)obj).getBigInteger();
     
    386386            BigInteger quotient = results[0];
    387387            BigInteger remainder = results[1];
    388             values[0] = number(quotient);
    389             values[1] = (remainder.signum() == 0) ? Fixnum.ZERO : number(remainder);
     388            value1 = number(quotient);
     389            value2 = (remainder.signum() == 0) ? Fixnum.ZERO : number(remainder);
    390390    } else if (obj instanceof Bignum) {
    391391            BigInteger divisor = ((Bignum)obj).getValue();
     
    393393            BigInteger quotient = results[0];
    394394            BigInteger remainder = results[1];
    395             values[0] = number(quotient);
    396             values[1] = (remainder.signum() == 0) ? Fixnum.ZERO : number(remainder);
     395            value1 = number(quotient);
     396            value2 = (remainder.signum() == 0) ? Fixnum.ZERO : number(remainder);
    397397    } else if (obj instanceof Ratio) {
    398398            Ratio divisor = (Ratio) obj;
     
    401401            LispObject remainder =
    402402        subtract(quotient.multiplyBy(divisor));
    403             values[0] = quotient;
    404             values[1] = remainder;
     403            value1 = quotient;
     404            value2 = remainder;
    405405    } else
    406406            throw new ConditionThrowable(new LispError("Bignum.truncate(): not implemented: " + obj.typeOf()));
     
    411411            throw new ConditionThrowable(new ArithmeticError(e.getMessage()));
    412412        }
    413         thread.setValues(values);
    414         return values[0];
     413        return thread.setValues(value1, value2);
    415414    }
    416415
  • trunk/j/src/org/armedbear/lisp/Fixnum.java

    r4586 r4790  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Fixnum.java,v 1.77 2003-10-30 21:40:10 asimon Exp $
     5 * $Id: Fixnum.java,v 1.78 2003-11-16 18:29:19 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    449449    {
    450450        final LispThread thread = LispThread.currentThread();
    451         LispObject[] values = new LispObject[2];
     451        final LispObject value1, value2;
    452452  try {
    453453    if (obj instanceof Fixnum) {
     
    455455            long quotient = value / divisor;
    456456            long remainder = value % divisor;
    457             values[0] = number(quotient);
    458             values[1] = remainder == 0 ? Fixnum.ZERO : number(remainder);
     457            value1 = number(quotient);
     458            value2 = remainder == 0 ? Fixnum.ZERO : number(remainder);
    459459    } else if (obj instanceof Bignum) {
    460460            BigInteger value = getBigInteger();
     
    463463            BigInteger quotient = results[0];
    464464            BigInteger remainder = results[1];
    465             values[0] = number(quotient);
    466             values[1] = (remainder.signum() == 0) ? Fixnum.ZERO : number(remainder);
     465            value1 = number(quotient);
     466            value2 = (remainder.signum() == 0) ? Fixnum.ZERO : number(remainder);
    467467    } else if (obj instanceof Ratio) {
    468468            Ratio divisor = (Ratio) obj;
     
    471471            LispObject remainder =
    472472        subtract(quotient.multiplyBy(divisor));
    473             values[0] = quotient;
    474             values[1] = remainder;
     473            value1 = quotient;
     474            value2 = remainder;
    475475    } else
    476476            throw new ConditionThrowable(new LispError("Fixnum.truncate(): not implemented: " + obj.typeOf()));
     
    481481            throw new ConditionThrowable(new ArithmeticError(e.getMessage()));
    482482        }
    483         thread.setValues(values);
    484         return values[0];
     483        return thread.setValues(value1, value2);
    485484    }
    486485
  • trunk/j/src/org/armedbear/lisp/Ratio.java

    r4586 r4790  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Ratio.java,v 1.37 2003-10-30 21:40:10 asimon Exp $
     5 * $Id: Ratio.java,v 1.38 2003-11-16 18:25:31 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    404404    LispObject remainder = subtract(product);
    405405
    406     final LispThread thread = LispThread.currentThread();
    407     LispObject[] values = new LispObject[2];
    408     values[0] = number(quotient);
    409     values[1] = remainder;
    410     thread.setValues(values);
    411     return values[0];
     406          return LispThread.currentThread().setValues(number(quotient), remainder);
    412407        }
    413408        catch (ArithmeticException e) {
Note: See TracChangeset for help on using the changeset viewer.