#define MAX_NUM 3 // 変数の数
#define MAX_BIT_KETA 2 // 有効なビットの桁数
#include <stdio.h>
int main()
{
unsigned char fromData[MAX_NUM] = {0x03, 0x01, 0x02};
unsigned short toData = 0;
int i, j;
for (i = 0; i < MAX_BIT_KETA; i++) {
for (j = 0; j < MAX_NUM; j++) {
toData <<= 1;
if (fromData[j] & 0x01) {
toData |= 0x01;
}
fromData[j] >>= 1;
}
}
}
I2RlZmluZSBNQVhfTlVNICAgICAgMyAvLyDlpInmlbDjga7mlbAKI2RlZmluZSBNQVhfQklUX0tFVEEgMiAvLyDmnInlirnjgarjg5Pjg4Pjg4jjga7moYHmlbAKCiNpbmNsdWRlIDxzdGRpby5oPgoKaW50IG1haW4oKQp7CiAgICB1bnNpZ25lZCBjaGFyICBmcm9tRGF0YVtNQVhfTlVNXSA9IHsweDAzLCAweDAxLCAweDAyfTsKICAgIHVuc2lnbmVkIHNob3J0IHRvRGF0YSA9IDA7CiAgICBpbnQgaSwgajsKCiAgICBmb3IgKGkgPSAwOyBpIDwgTUFYX0JJVF9LRVRBOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBqIDwgTUFYX05VTTsgaisrKSB7CiAgICAgICAgICAgIHRvRGF0YSA8PD0gMTsKICAgICAgICAgICAgaWYgKGZyb21EYXRhW2pdICYgMHgwMSkgewogICAgICAgICAgICAgICAgdG9EYXRhIHw9IDB4MDE7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZnJvbURhdGFbal0gPj49IDE7CiAgICAgICAgfQogICAgfQoKICAgIHByaW50ZigiJXgiLCB0b0RhdGEpOwp9