...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <limits.h> signed int si_a; signed int si_b; signed int sum; void func(void) { /* Initialize si_a, si_b and sum*/ if ( ((si_a^si_b) | (((si_a^(~(si_a^si_b) & INT_MIN)) + si_b)^si_b)) >= 0) { /* Handle error condition */ } else { sum = si_a + si_b; } /* ... */ } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <limits.h>
signed long s_a;
signed long s_b;
signed long result;
void func(void) {
/* Initialize s_a, s_b and result */
if ((s_b == 0 ) || ((s_a == LONG_MIN) && (s_b == -1))) {
/* Handle error condition */
} else {
result = s_a % s_b;
}
/* ... */
} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <limits.h>
signed long s_a;
signed long s_b;
signed long result;
void func(void) {
/* Initialize s_a, s_b and result */
if (s_b == 0) {
/* Handle error condition */
} else {
if ((s_b < 0) && (s_b != LONG_MIN)) {
s_b = -s_b;
}
result = s_a % s_b;
}
/* ... */
} |
...