Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement UPGRADED-ARRAY-ELEMENT-TYPE for non-specialized byte types #617

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading