main: refacto

This commit is contained in:
theBigBlase 2023-10-06 22:23:37 -04:00
parent 76ee7c2fab
commit 01353032b4

View file

@ -50,28 +50,26 @@ main(int argc, char *argv[])
free(res);
#endif
printf("\n--- MSG ---\nas 0x: ");
#ifdef TEST_ZERO
msg = 0;
printf("0x00000000\n");
#endif
printf("\n--- MSG ---\n");
#ifdef TEST_MAX
msg = UINT32_MAX;
printf("0xffffffff\n");
#ifdef TEST_ZERO
msg = 0x00000000;
#endif
#ifdef TEST_MID
printf("0x0000ffff\n");
/* is UINT16_MAX, but keeping this way for corrector convenience */
msg = UINT32_MAX & UINT16_MAX;
msg = 0x0000ffff;
#endif
#ifdef TEST_MAX
msg = 0xffffffff;
#endif
#ifdef TEST_NAME
msg = *(uint32_t *)"bob";
printf("%u\n", msg);
#endif
printf("as 0x: %x\n", msg);
char *msg_char = uint32_to_char_arr(msg);
printf("as char *: %s\nas uint32: %u\n",
@ -125,21 +123,27 @@ gen()
static struct eve
eve_shenanigans(struct eve str)
{
#ifdef EVE_NAME
#ifdef EVE_ZERO
uint32_t old_msg = str.msg;
str.msg = *(uint32_t *)"eve";
str.msg = 0x00000000;
str.tag = str.tag ^ old_msg ^ str.msg;
#endif
#ifdef EVE_ZERO
#ifdef EVE_MID
uint32_t old_msg = str.msg;
str.msg = 0;
str.msg = 0x0000ffff;
str.tag = str.tag ^ old_msg ^ str.msg;
#endif
#ifdef EVE_MAX
uint32_t old_msg = str.msg;
str.msg = UINT32_MAX;
str.msg = 0xffffffff;
str.tag = str.tag ^ old_msg ^ str.msg;
#endif
#ifdef EVE_NAME
uint32_t old_msg = str.msg;
str.msg = *(uint32_t *)"eve";
str.tag = str.tag ^ old_msg ^ str.msg;
#endif