You can't have that code. THere are unbalanced brackets in the 'it' statements.
And " mac1 = 0x10" is missing the semicolon.
I've made a compellable program:
Code:
#include <stdio.h>
#include <stdint.h>
typedef uint8_t byte;
char local_1[4] = {0xFF, 0x5F, 0x09, 0xCF};
int main(int argc, char *argv[]) {
char mac1;
if ((byte)(local_1[0] - 0x30U) < 10) {
mac1 = (short) local_1[0] + -0x30;
} else if ((byte)(local_1[0] +0xbfU) < 6) {
mac1 = (short) local_1[0] + -0x37;
} else if ((byte)(local_1[0] +0x9fU) < 6) {
mac1 = (short) local_1[0] + -0x57;
} else {
mac1 = 0x10;
}
printf("mac1 is %u\n",mac1);
return 0;
}
Here's the compilation output with warnings on:
Code:
$ gcc -o help help.c -Wall -pedantic
help.c:4:20: warning: overflow in implicit constant conversion [-Woverflow]
char local_1[4] = {0xFF, 0x5F, 0x09, 0xCF};
^~~~
help.c:4:38: warning: overflow in implicit constant conversion [-Woverflow]
char local_1[4] = {0xFF, 0x5F, 0x09, 0xCF};
^~~~
As a general rule of thumb, all the cool kids working on portable system-level code are using the types in stdint.h:
uint8_t - 8-bit unsigned
uint16_t - 16-bit unsigned
uint32_t - 32-bit unsigned
uint64_t - 64-bit unsigned
int8_t - 8-bit signed
int16_t - 16-bit signed
int32_t - 32-bit signed
int64_t - 64-bit signed