| 1 |
static int Sub(int a, int b) { |
| 2 |
return b -a; |
| 3 |
} |
| 4 |
|
| 5 |
static unsigned Select(unsigned a, unsigned b, unsigned c) { |
| 6 |
const int pa_minus_pb = |
| 7 |
Sub((a >> 8) & 0xff, (b >> 8) & 0xff) + |
| 8 |
Sub((a >> 0) & 0xff, (b >> 0) & 0xff); |
| 9 |
return (pa_minus_pb <= 0) ? a : b; |
| 10 |
} |
| 11 |
|
| 12 |
__attribute__((noinline)) unsigned Predictor(unsigned left, const unsigned* const top) { |
| 13 |
const unsigned pred = Select(top[1], left, top[0]); |
| 14 |
return pred; |
| 15 |
} |
| 16 |
|
| 17 |
int main(void) { |
| 18 |
const unsigned top[2] = {0xff7a7a7a, 0xff7a7a7a}; |
| 19 |
const unsigned left = 0xff7b7b7b; |
| 20 |
const unsigned pred = Predictor(left, top /*+ 1*/); |
| 21 |
if (pred == left) |
| 22 |
return 0; |
| 23 |
return 1; |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
|