4 added 87 characters in body
source | link

enter image description here

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:

enter image description here

If you decide to go with a structure approach, you will have something similar to this:

3 edited body
source | link

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
source | link
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
source | link