Skip to content

Conversation

@LukeSerne
Copy link
Contributor

This new cleanup rule tries to eliminate comparisons with booleans. Such comparisons would often be shown as x != false in decompiler output, which is more complex than strictly necessary - x == true or even just x would suffice. This rule changes such boolean expressions to completely remove the equality check, leading to less complex decompiler output.

Before

void ActivateItem(struct *param_1,int param_2)

{
  if (param_1->mItems[param_2].mIsActive != false)
  {
    param_1->mItems[param_2].mIsActive = false;
  }
  return;
}

After

void ActivateItem(struct *param_1,int param_2)

{
  if (param_1->mItems[param_2].mIsActive)
  {
    param_1->mItems[param_2].mIsActive = false;
  }
  return;
}

This new cleanup rule tries to eliminate comparisons with booleans. Such
comparisons would often be shown as "x != false", which is more complex
than strictly necessary - "x == true" or even just "x" would suffice.
This rule changes such boolean expressions to completely remove the
equality check, leading to less complex decompiler output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: Decompiler Status: Triage Information is being gathered

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants