translate-c: only detect ints as negative if they are signed.

This commit is contained in:
Sahnvour 2019-01-26 15:53:19 +01:00
parent b2662e443d
commit 584cb1fcfe

View File

@ -468,7 +468,7 @@ static const char *decl_name(const Decl *decl) {
static AstNode *trans_create_node_apint(Context *c, const llvm::APSInt &aps_int) {
AstNode *node = trans_create_node(c, NodeTypeIntLiteral);
node->data.int_literal.bigint = allocate<BigInt>(1);
bool is_negative = aps_int.isNegative();
bool is_negative = aps_int.isSigned() && aps_int.isNegative();
if (!is_negative) {
bigint_init_data(node->data.int_literal.bigint, aps_int.getRawData(), aps_int.getNumWords(), false);
return node;