Changeset 3567


Ignore:
Timestamp:
09/04/03 00:16:39 (20 years ago)
Author:
piso
Message:

SYS::GCD-2

File:
1 edited

Legend:

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

    r3565 r3567  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.367 2003-09-03 23:44:01 piso Exp $
     5 * $Id: Primitives.java,v 1.368 2003-09-04 00:16:39 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    48154815    }
    48164816
     4817    // ### gcd-2
     4818    private static final Primitive2 GCD_2 =
     4819        new Primitive2("gcd-2", PACKAGE_SYS, false)
     4820    {
     4821        public LispObject execute(LispObject first, LispObject second)
     4822            throws LispError
     4823        {
     4824            BigInteger n1, n2;
     4825            if (first instanceof Fixnum)
     4826                n1 = BigInteger.valueOf(((Fixnum)first).getValue());
     4827            else if (first instanceof Bignum)
     4828                n1 = ((Bignum)first).getValue();
     4829            else
     4830                throw new TypeError(first, "integer");
     4831            if (second instanceof Fixnum)
     4832                n2 = BigInteger.valueOf(((Fixnum)second).getValue());
     4833            else if (second instanceof Bignum)
     4834                n2 = ((Bignum)second).getValue();
     4835            else
     4836                throw new TypeError(second, "integer");
     4837            return number(n1.gcd(n2));
     4838        }
     4839    };
     4840
    48174841    // ### hashcode-to-string
    48184842    private static final Primitive1 HASHCODE_TO_STRING =
Note: See TracChangeset for help on using the changeset viewer.