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:
kai
2012-12-30 14:56:53 +01:00
parent a3975b7f47
commit e684d10ac7
2 changed files with 38 additions and 50 deletions

View File

@@ -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 {