#include <assert.h>
#include <stdio.h>
#include "xalloc.h"
#include <stdint.h>

int main() {
  unsigned char c = 0xF0;
  int i1 = (int)(unsigned int) c;
  int i2 = (int)(signed char) c;
  assert(i1 == 240);
  assert(i2 == -16);
  printf("All tests passed!\n");
  printf("If we do it directly? We get %d.\n", (int)c);

  unsigned char c1 = 0xBE;
  unsigned char c2 = 0xEF;
  short s = ((short)c1 << 8) | (short)c2;

  printf("We got the 0x%hX\n", s);

  int x = 12;
  int *y = xcalloc(1, sizeof(int));
  int *z;
  intptr_t ipx = (intptr_t)&x;
  uintptr_t ipy = (uintptr_t)y;
  z = (int*)ipx;
  z = (int*)ipy;

  return 0;
}
