harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b799ccf9aae67426dd2bd819fa3d1848b6dd7161
parent 67cc0152d27f5b777313d4969f14d5ce296152b3
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 23 Dec 2020 16:18:00 -0500

gen: DRY

Diffstat:
Msrc/gen.c | 8++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -311,22 +311,18 @@ gen_expr_unarithm(struct gen_context *ctx, gen_expression(ctx, expr->unarithm.operand, &operand); struct qbe_value temp = {0}; + temp.kind = QV_CONST; + temp.type = otype; switch (expr->unarithm.op) { case UN_LNOT: - temp.kind = QV_CONST; - temp.type = otype; temp.lval = 1; pushi(ctx->current, &result, Q_XOR, &temp, &operand, NULL); break; case UN_BNOT: - temp.kind = QV_CONST; - temp.type = otype; temp.lval = (uint64_t)-1; pushi(ctx->current, &result, Q_XOR, &temp, &operand, NULL); break; case UN_MINUS: - temp.kind = QV_CONST; - temp.type = otype; temp.lval = 0; pushi(ctx->current, &result, Q_SUB, &temp, &operand, NULL); break;