Changeset 3556


Ignore:
Timestamp:
09/02/03 17:40:29 (19 years ago)
Author:
piso
Message:

INTEGER-LENGTH

File:
1 edited

Legend:

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

    r3555 r3556  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.364 2003-09-02 16:33:28 piso Exp $
     5 * $Id: Primitives.java,v 1.365 2003-09-02 17:40:29 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    47724772    };
    47734773
     4774    // ### integer-length
     4775    private static final Primitive1 INTEGER_LENGTH =
     4776        new Primitive1("integer-length") {
     4777        public LispObject execute(LispObject arg) throws TypeError
     4778        {
     4779            BigInteger value;
     4780            if (arg instanceof Fixnum)
     4781                value = BigInteger.valueOf(((Fixnum)arg).getValue());
     4782            else if (arg instanceof Bignum)
     4783                value = ((Bignum)arg).getValue();
     4784            else
     4785                throw new TypeError(arg, "integer");
     4786            return new Fixnum(value.bitLength());
     4787        }
     4788    };
     4789
    47744790    // ### hashcode-to-string
    47754791    private static final Primitive1 HASHCODE_TO_STRING =
Note: See TracChangeset for help on using the changeset viewer.