| 897 | |
| 898 | |
| 899 | auto TransTableL::create_or_update( |
| 900 | WinBlock * bp, |
| 901 | const WinMatch& search, |
| 902 | const bool flag) -> void |
| 903 | { |
| 904 | // Either updates an existing SOP or creates a new one. |
| 905 | // A new one is created at the end of the bp list_ if this |
| 906 | // is not already full, or the oldest one in the list_ is |
| 907 | // overwritten. |
| 908 | |
| 909 | WinMatch * wp = bp->list_; |
| 910 | int n = bp->next_match_no_; |
| 911 | |
| 912 | for (int i = 0; i < n; i++, wp++) { |
| 913 | if (wp->xor_set_ != search.xor_set_ ) continue; |
| 914 | if (wp->mask_index_ != search.mask_index_) continue; |
| 915 | if (wp->top_set1_ != search.top_set1_ ) continue; |
| 916 | if (wp->top_set2_ != search.top_set2_ ) continue; |
| 917 | if (wp->top_set3_ != search.top_set3_ ) continue; |
| 918 | |
| 919 | NodeCards& node = wp->first_; |
| 920 | if (search.first_.lower_bound > node.lower_bound) |
| 921 | node.lower_bound = search.first_.lower_bound; |
| 922 | if (search.first_.upper_bound < node.upper_bound) |
| 923 | node.upper_bound = search.first_.upper_bound; |
| 924 | |
| 925 | node.best_move_suit = search.first_.best_move_suit; |
| 926 | node.best_move_rank = search.first_.best_move_rank; |
| 927 | return; |
| 928 | } |
| 929 | |
| 930 | if (n == BlocksPerEntry) { |
| 931 | if (bp->next_write_no_ >= BlocksPerEntry) |
| 932 | bp->next_write_no_ = 0; |
| 933 | } |
| 934 | else |
| 935 | bp->next_match_no_++; |
| 936 | |
| 937 | |
| 938 | wp = &bp->list_[ bp->next_write_no_++ ]; |
| 939 | *wp = search; |
| 940 | |
| 941 | if (!flag) { |
| 942 | wp->first_.best_move_suit = 0; |
| 943 | wp->first_.best_move_rank = 0; |
| 944 | } |
| 945 | } |
| 946 | |
| 947 | |
| 948 | auto TransTableL::add( |
nothing calls this directly
no outgoing calls
no test coverage detected