1 21 22 package org.armedbear.lisp; 23 24 import java.math.BigInteger ; 25 26 public final class lognor extends Primitive2 27 { 28 private lognor(String name, String arglist) 29 { 30 super(name,arglist); 31 } 32 33 public LispObject execute(LispObject first, LispObject second) 34 throws ConditionThrowable 35 { 36 if (first instanceof Fixnum) { 37 if (second instanceof Fixnum) 38 return new Fixnum(~(((Fixnum)first).getValue() | 39 ((Fixnum)second).getValue())); 40 if (second instanceof Bignum) { 41 BigInteger n1 = ((Fixnum)first).getBigInteger(); 42 BigInteger n2 = ((Bignum)second).getValue(); 43 return number(n1.or(n2).not()); 44 } 45 return signal(new TypeError(second, "integer")); 46 } 47 if (first instanceof Bignum) { 48 BigInteger n1 = ((Bignum)first).getValue(); 49 if (second instanceof Fixnum) { 50 BigInteger n2 = ((Fixnum)second).getBigInteger(); 51 return number(n1.or(n2).not()); 52 } 53 if (second instanceof Bignum) { 54 BigInteger n2 = ((Bignum)second).getValue(); 55 return number(n1.or(n2).not()); 56 } 57 return signal(new TypeError(second, "integer")); 58 } 59 return signal(new TypeError(first, "integer")); 60 } 61 62 private static final lognor LOGNOR = new lognor("lognor","integer-1 integer-2"); 63 } 64 | Popular Tags |