Changeset 3563


Ignore:
Timestamp:
09/02/03 23:32:54 (19 years ago)
Author:
piso
Message:

multiplyBy()

File:
1 edited

Legend:

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

    r3558 r3563  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Bignum.java,v 1.32 2003-09-02 18:27:01 piso Exp $
     5 * $Id: Bignum.java,v 1.33 2003-09-02 23:32:54 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    216216    public LispObject multiplyBy(LispObject obj) throws LispError
    217217    {
    218         if (obj instanceof Fixnum)
    219             return new Bignum(value.multiply(Fixnum.getBigInteger(obj)));
     218        if (obj instanceof Fixnum) {
     219            int n = ((Fixnum)obj).getValue();
     220            if (n == 0)
     221                return Fixnum.ZERO;
     222            if (n == 1)
     223                return this;
     224            return new Bignum(value.multiply(BigInteger.valueOf(n)));
     225        }
    220226        if (obj instanceof Bignum)
    221227            return new Bignum(value.multiply(((Bignum)obj).value));
Note: See TracChangeset for help on using the changeset viewer.