4 added 87 characters in body edited Jul 21 '17 at 15:53 Carlos 9877 bronze badges If you decide to go with a structure approach, you will have something similar to this: If you decide to go with a structure approach, you will have something similar to this: If you decide to go with a structure approach, you will have something similar to this: 3 edited body edited Jul 21 '17 at 15:43 Carlos 9877 bronze badges 0000 0000 0000 0000 – index of square origin 0000 0000 0000 0000 – index of squiresquare destination 0000 0000 0000 0000 – move type (flag) 0000 0000 0000 0000 – index of square origin 0000 0000 0000 0000 – index of squire destination 0000 0000 0000 0000 – move type (flag) 0000 0000 0000 0000 – index of square origin 0000 0000 0000 0000 – index of square destination 0000 0000 0000 0000 – move type (flag) 2 added 1 character in body edited Jul 19 '17 at 17:49 Carlos 9877 bronze badges ``````unsigned int move; //insert square origin using 6 bits move = (origin & 0x3f << 6); -the hex to mask 6 bits. // insert square destination using also 6 bits move = (destination & 0x3f); //insert the flag move = ((flag & 0xf) << 12); // now putting everything together… Move make_move(Square from, Square to, unsigned int flag) { Return move = ((flag & 0xf) << 12) | (destination & 0x3f) | (origin & 0x3f) << 6; } `````` ``````unsigned int move; //insert square origin using 6 bits move = (origin & 0x3f << 6); -the hex to mask 6 bits. // insert square destination using also 6 bits move = (destination & 0x3f); //insert the flag move = ((flag & 0xf) << 12); // now putting everything together… Move make_move(Square from, Square to, unsigned int flag) { Return move = ((flag & 0xf) << 12) | (destination & 0x3f) | (origin & 0x3f << 6; } `````` ``````unsigned int move; //insert square origin using 6 bits move = (origin & 0x3f << 6); -the hex to mask 6 bits. // insert square destination using also 6 bits move = (destination & 0x3f); //insert the flag move = ((flag & 0xf) << 12); // now putting everything together… Move make_move(Square from, Square to, unsigned int flag) { Return move = ((flag & 0xf) << 12) | (destination & 0x3f) | (origin & 0x3f) << 6; } `````` 1 answered Jul 19 '17 at 16:51 Carlos 9877 bronze badges