Skip to content

Instantly share code, notes, and snippets.

@yukpiz
Last active July 12, 2016 02:58
Show Gist options
  • Save yukpiz/cf7ecfccc965063f51cc39746ff6bb28 to your computer and use it in GitHub Desktop.
Save yukpiz/cf7ecfccc965063f51cc39746ff6bb28 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
void main()
{
uint32_t nr1 = (uint32_t)-1;
uint32_t nr2 = (uint32_t)0xffffffffUL;
printf("%d\n", nr1);
printf("%d\n", nr2);
printf("%d\n", sizeof(uint32_t));
if (sizeof(uint32_t) != 4)
{
printf("uint32_t size not 4.");
exit(1);
}
if (nr1 != 0xffffffffUL)
{
printf("nr1 error.");
exit(1);
}
if (nr2 + 1 != 0)
{
printf("nr2 error.");
exit(1);
}
printf("all ok");
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment