From 223e20cbbc8f45fa4c34615c43488f54f4f7765e Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 16 Mar 2025 11:52:11 -0400 Subject: [PATCH] ssb: Fix the tests. --- src/ssb.ebt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ssb.ebt.c b/src/ssb.ebt.c index 1b03d8c6..40fed1a2 100644 --- a/src/ssb.ebt.c +++ b/src/ssb.ebt.c @@ -195,15 +195,11 @@ static void _ebt_add_to_clock(ebt_get_clock_t* work, const char* id, int64_t val ebt_entry_t* entry = _ebt_get_entry(work->ebt, id); if (entry) { - entry->out = value; - entry->out_replicate = entry->out_replicate || replicate; - entry->out_receive = entry->out_receive || receive; - if ((replicate && !entry->out_replicate) || (receive && !entry->out_receive) || ((replicate || receive || entry->out_replicate || entry->out_receive) && entry->out != value)) { int index = tf_util_insert_index(id, count ? work->clock->entries : NULL, count, sizeof(tf_ssb_ebt_clock_entry_t), _ebt_compare_entry); - int64_t out_value = entry->out_replicate ? ((value << 1) | (entry->out_receive ? 0 : 1)) : -1; + int64_t out_value = (entry->out_replicate || replicate) ? ((tf_max(entry->out, value) << 1) | ((entry->out_receive || receive) ? 0 : 1)) : -1; if (index < count && strcmp(id, work->clock->entries[index].id) == 0) { work->clock->entries[index].value = out_value; @@ -220,6 +216,10 @@ static void _ebt_add_to_clock(ebt_get_clock_t* work, const char* id, int64_t val work->clock->count = count + 1; } } + + entry->out = tf_max(entry->out, value); + entry->out_replicate = entry->out_replicate || replicate; + entry->out_receive = entry->out_receive || receive; } }