#include <inttypes.h>
#include <stdio.h>

int combine(int x, int y) {
  return (y & 0xffffff00) | (x & 0xff);
}

int checkbit1(int x) {

  return (x || 0);
}

int checkbit0(int x) {
	
	return (!!~x);
}

int checkLSB1(int x) {
	
	return ((x & 1) || 0); //ou x & 0xFF
}

int checkMSB0(int x) {
	

	//return ( !!(~x >>= (sizeof(int)-1)) ); //shift de n-1 pour avoir l'octet le plus signifiant en dernière place
	return ( !!(~x & 0xFF000000));
}

unsigned rotate_left(unsigned x, int n) {
	
	unsigned left = (x << n);
	unsigned right = x >> (sizeof(int)- ((n-1)*8));

	return left | right ;
}

main() {
  printf("%x\n", checkbit1(0));
  printf("%x\n", checkbit1(26));

  printf("%x\n", checkbit0(0x11111111));
  printf("%x\n", checkbit0(0x800b0d0f));

  printf("%x\n", checkLSB1(0x76543210));
  printf("%x\n", checkLSB1(0x89abcdef));

  printf("%x\n", checkMSB0(0x76543210));
  printf("%x\n", checkMSB0(0x10abcdef));

  printf("%x\n", rotate_left(0x12345678, 4));
  printf("%x\n", rotate_left(0x12345678, 20));

  printf("%x8", combine(0x89abcdef, 0x76543210));
}
