Skip to content

Commit

Permalink
Implement UPGRADED-ARRAY-ELEMENT-TYPE for non-specialized byte types
Browse files Browse the repository at this point in the history
Addresses <#508>.
  • Loading branch information
easye committed Aug 21, 2023
1 parent d2979ee commit 9fbe866
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/org/armedbear/lisp/Lisp.java
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,27 @@ public static final LispObject getUpgradedArrayElementType(LispObject type)
}
}
}
else if (car.equals(Symbol.UNSIGNED_BYTE))
{
LispObject bits = type.cadr();
if (!(bits instanceof Fixnum)) {
simple_error("bad size specified for UNSIGNED-BYTE type specifier: ~a", bits);
}
int b = ((Fixnum)bits).value;
if (0 == b) {
simple_error("bad size specified for UNSIGNED-BYTE type specifier: ~a", bits);
} else if (1 == b) {
return Symbol.BIT;
} else if (1 <= b && b <= 8) {
return UNSIGNED_BYTE_8;
} else if (9 <= b && b <= 16) {
return UNSIGNED_BYTE_16;
} else if (17 <= b && b <= 32) {
return UNSIGNED_BYTE_32;
} else {
return T;
}
}
else if (car == Symbol.EQL)
{
LispObject obj = type.cadr();
Expand Down

0 comments on commit 9fbe866

Please sign in to comment.