Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inline bool hasWon(int player) const {
- // H, V, DL, DR
- const __m256i masks = _mm256_setr_epi64x(0x7E3F1F8FC7E3F1F8ULL, 0x7FFFFFFFFFFFFFFFULL, 0x7E3F1F8FC7E3F1F8ULL, 0xFC7E3F1F8FC7E3FULL);
- const __m256i first_Shift = _mm256_setr_epi64x(1, 9, 10, 8);
- const __m256i second_Shift = _mm256_setr_epi64x(2, 18, 20, 16);
- const __m256i board = _mm256_set1_epi64x(boards[player]);
- __m256i temp = _mm256_and_si256(board, _mm256_sllv_epi64(board, first_Shift));
- temp = _mm256_and_si256(_mm256_and_si256(temp, _mm256_sllv_epi64(temp, second_Shift)), masks);
- return !_mm256_testz_si256(temp, temp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement