Skip to content

Commit

Permalink
Add ad-hoc exception for converting fixnums to bytes
Browse files Browse the repository at this point in the history
Allows
<armedbear@72a5d76>
to work without needing to patch SLIME by performing conversion of
fixnum representation of byte value.  The same should probably be done
for Bignum, and other descendents of LispInteger more systematically.

Resolves <armedbear#141>.
  • Loading branch information
easye committed Jan 3, 2020
1 parent 734b0f3 commit 3138049
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/org/armedbear/lisp/Fixnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public Object javaInstance(Class c)
return Long.valueOf((long)value);
if (Integer.class.equals(c) || int.class.equals(c))
return Integer.valueOf(value);
if (c.isAssignableFrom(Byte.TYPE)) {
// are we in range?
return ((java.lang.Number)value).byteValue();
}

int i = 1;

return error(new TypeError("Cannot convert Fixnum to " + c.getName()));
}
Expand Down

0 comments on commit 3138049

Please sign in to comment.