Skip to content

Complement operator (~tilda) is not supported #241

@pavel-chumakou

Description

@pavel-chumakou

According to B users' reference: "complement operator ~, when applied to an rvalue, turns all 1 bits to 0 and all 0 bits to 1."
But current implementation doesn't support ~ operator with LEXER ERROR: Unknown token ~
Actually ~x = -x - 1, so we can leave without complement operator. But imo it's better to have it.
I implemented it locally on my machine, it's just one notq operator for x86_64:

           Op::Complement { result, arg } => {
                load_arg_to_reg(arg, c!("rax"), output, os);
                sb_appendf(output, c!("    notq %%rax\n"));
               .....

So I can create a pull-request. Not sure how to implement (and test) it for other targets though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions