mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-08-10 16:30:05 +02:00
Cleanup of complex type handling.
- replace if .. else cascades with swicth - replace assert(0) with llvm_unreachable as default case - add some whitespaces in parameter lists
This commit is contained in:
15
gen/toir.cpp
15
gen/toir.cpp
@@ -413,15 +413,12 @@ DValue* ComplexExp::toElem(IRState* p)
|
||||
LLValue* res;
|
||||
|
||||
if (c->isNullValue()) {
|
||||
Type* t = type->toBasetype();
|
||||
if (t->ty == Tcomplex32)
|
||||
c = DtoConstFP(Type::tfloat32, ldouble(0));
|
||||
else if (t->ty == Tcomplex64)
|
||||
c = DtoConstFP(Type::tfloat64, ldouble(0));
|
||||
else if (t->ty == Tcomplex80)
|
||||
c = DtoConstFP(Type::tfloat80, ldouble(0));
|
||||
else
|
||||
assert(0);
|
||||
switch (type->toBasetype()->ty) {
|
||||
default: llvm_unreachable("Unexpected complex floating point type");
|
||||
case Tcomplex32: c = DtoConstFP(Type::tfloat32, ldouble(0)); break;
|
||||
case Tcomplex64: c = DtoConstFP(Type::tfloat64, ldouble(0)); break;
|
||||
case Tcomplex80: c = DtoConstFP(Type::tfloat80, ldouble(0)); break;
|
||||
}
|
||||
res = DtoAggrPair(DtoType(type), c, c);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user