2 smaller constants
source | link

C - 4 tokens

int div3(int x) {
    return ((x * 43) >> 7) * 3 == x;
}

Works up to 383.

Previous version (bigger constants):

int div3(int x) {
    return ((x * 171) >> 9) * 3 == x;
}

Works up to 1535

C - 4 tokens

int div3(int x) {
    return ((x * 171) >> 9) * 3 == x;
}

Works up to 1535

C - 4 tokens

int div3(int x) {
    return ((x * 43) >> 7) * 3 == x;
}

Works up to 383.

Previous version (bigger constants):

int div3(int x) {
    return ((x * 171) >> 9) * 3 == x;
}

Works up to 1535

1
source | link

C - 4 tokens

int div3(int x) {
    return ((x * 171) >> 9) * 3 == x;
}

Works up to 1535