fix mode directed tabling.

This commit is contained in:
Joao 2011-11-09 12:03:09 +00:00
parent dab7c00e60
commit 1e7fc1afce

View File

@ -1215,7 +1215,7 @@ static inline ans_node_ptr answer_search_mode_directed_min_max(sg_fr_ptr sg_fr,
if (IsIntTerm(child_term)) { if (IsIntTerm(child_term)) {
trie_value = (Float) IntOfTerm(child_term); trie_value = (Float) IntOfTerm(child_term);
} else if (IsApplTerm(child_term)) { } else if (IsApplTerm(child_term)) {
Functor f = FunctorOfTerm(child_term); Functor f = (Functor) RepAppl(child_term);
child_node = TrNode_child(child_node); child_node = TrNode_child(child_node);
if (f == FunctorLongInt) { if (f == FunctorLongInt) {
trie_value = (Float) TrNode_entry(child_node); trie_value = (Float) TrNode_entry(child_node);
@ -1255,7 +1255,7 @@ static inline ans_node_ptr answer_search_mode_directed_min_max(sg_fr_ptr sg_fr,
if (term_value == trie_value) if (term_value == trie_value)
return child_node; return child_node;
/* better answer */ /* better answer */
invalidate_answer_trie(child_node, sg_fr, TRAVERSE_POSITION_FIRST); invalidate_answer_trie(TrNode_child(current_node), sg_fr, TRAVERSE_POSITION_FIRST);
TrNode_child(current_node) = NULL; TrNode_child(current_node) = NULL;
if (IsAtomOrIntTerm(t)) { if (IsAtomOrIntTerm(t)) {
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t, _trie_retry_atom + in_pair); ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t, _trie_retry_atom + in_pair);