Skip to content

Auto format changes #1791

Description

@asimes

I noticed some changes in auto format in Processing 2.0 Beta 9, and one change I found problematic was that shorthand for single line conditionals no longer are single line. For example, if I have statements like these:

if (in[i] == 1) out += (i%4) + (i>>2);
else if (in[i] == 2) out += abs((i%4)-1) + (i>>2);
else if (in[i] == 3) out += abs((i%4)-2) + (i>>2);
else if (in[i] == 4) out += abs((i%4)-3) + (i>>2);
else if (in[i] == 5) out += (i%4) + abs((i>>2)-1);
else if (in[i] == 6) out += abs((i%4)-1) + abs((i>>2)-1);
else if (in[i] == 7) out += abs((i%4)-2) + abs((i>>2)-1);
else if (in[i] == 8) out += abs((i%4)-3) + abs((i>>2)-1);
else if (in[i] == 9) out += (i%4) + abs((i>>2)-2);
else if (in[i] == 10) out += abs((i%4)-1) + abs((i>>2)-2);
else if (in[i] == 11) out += abs((i%4)-2) + abs((i>>2)-2);
else if (in[i] == 12) out += abs((i%4)-3) + abs((i>>2)-2);
else if (in[i] == 13) out += (i%4) + abs((i>>2)-3);
else if (in[i] == 14) out += abs((i%4)-1) + abs((i>>2)-3);
else if (in[i] == 15) out += abs((i%4)-2) + abs((i>>2)-3);
else if (in[i] == 0) continue;

It becomes this:

if (in[i] == 1) out += (i%4) + (i>>2); else if (in[i] == 2) out += abs((i%4)-1) + (i>>2); else if (in[i] == 3) out += abs((i%4)-2) + (i>>2); else if (in[i] == 4) out += abs((i%4)-3) + (i>>2); else if (in[i] == 5) out += (i%4) + abs((i>>2)-1); else if (in[i] == 6) out += abs((i%4)-1) + abs((i>>2)-1); else if (in[i] == 7) out += abs((i%4)-2) + abs((i>>2)-1); else if (in[i] == 8) out += abs((i%4)-3) + abs((i>>2)-1); else if (in[i] == 9) out += (i%4) + abs((i>>2)-2); else if (in[i] == 10) out += abs((i%4)-1) + abs((i>>2)-2); else if (in[i] == 11) out += abs((i%4)-2) + abs((i>>2)-2); else if (in[i] == 12) out += abs((i%4)-3) + abs((i>>2)-2); else if (in[i] == 13) out += (i%4) + abs((i>>2)-3); else if (in[i] == 14) out += abs((i%4)-1) + abs((i>>2)-3); else if (in[i] == 15) out += abs((i%4)-2) + abs((i>>2)-3); else if (in[i] == 0) continue;

Can this be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions