Changeset 3549


Ignore:
Timestamp:
09/02/03 15:07:25 (19 years ago)
Author:
piso
Message:

evenp(), oddp()

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

Legend:

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

    r3545 r3549  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Bignum.java,v 1.29 2003-09-02 04:35:29 piso Exp $
     5 * $Id: Bignum.java,v 1.30 2003-09-02 15:07:25 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    101101            return this;
    102102        return new Bignum(value.negate());
     103    }
     104
     105    public boolean evenp() throws TypeError
     106    {
     107        return !value.testBit(0);
     108    }
     109
     110    public boolean oddp() throws TypeError
     111    {
     112        return value.testBit(0);
    103113    }
    104114
  • trunk/j/src/org/armedbear/lisp/Fixnum.java

    r3537 r3549  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Fixnum.java,v 1.55 2003-08-27 16:15:10 piso Exp $
     5 * $Id: Fixnum.java,v 1.56 2003-09-02 15:06:53 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    110110            return this;
    111111        return number(-((long)value));
     112    }
     113
     114    public boolean evenp() throws TypeError
     115    {
     116        return (value & 0x01) == 0;
     117    }
     118
     119    public boolean oddp() throws TypeError
     120    {
     121        return (value & 0x01) != 0;
    112122    }
    113123
Note: See TracChangeset for help on using the changeset viewer.