Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS bitwise else if minifies incorrectly #335

Closed
JRaspass opened this issue Sep 29, 2020 · 3 comments
Closed

JS bitwise else if minifies incorrectly #335

JRaspass opened this issue Sep 29, 2020 · 3 comments

Comments

@JRaspass
Copy link

Apologies if this works with the unreleased code, I've only tested the current latest published version.

This

function foo(bar) {
    if ((bar & 0xFFFFF800) == 0) {
        return 1;
    }
    else if ((bar & 0xFFFF0000) == 0) {
        return 2;
    }
    return 3;
}

Minifes to this, note the lack of return 3 at all

function foo(a){if((a&4294965248)==0)return 1;if((a&4294901760)==0)return 2;if((a&2492471136)==0)return 2}
JRaspass added a commit to code-golf/code-golf that referenced this issue Sep 29, 2020
This also works around a bug in the minifier -
tdewolff/minify#335
@tdewolff
Copy link
Owner

Thanks for the bug report, I'll release a new version soon!

@JRaspass
Copy link
Author

Thank you for a fast fix!

@tdewolff
Copy link
Owner

tdewolff commented Oct 1, 2020

Has been released in v2.9.6!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants