mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 19:06:02 +03:00
Special case DtoCastInt for bool.
This commit is contained in:
parent
bc80a83666
commit
fe49ee6448
1 changed files with 2 additions and 2 deletions
|
@ -570,7 +570,7 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
|
|||
}
|
||||
|
||||
if (to->isintegral()) {
|
||||
if (fromsz < tosz) {
|
||||
if (fromsz < tosz || from->ty == Tbool) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast to: " << *tolltype << '\n';
|
||||
if (from->isunsigned() || from->ty == Tbool) {
|
||||
|
@ -579,7 +579,7 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
|
|||
rval = new llvm::SExtInst(rval, tolltype, "tmp", gIR->scopebb());
|
||||
}
|
||||
}
|
||||
else if (fromsz > tosz) {
|
||||
else if (fromsz > tosz || to->ty == Tbool) {
|
||||
rval = new llvm::TruncInst(rval, tolltype, "tmp", gIR->scopebb());
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue