From 6449916d22003284fe0d9ddcfd533c16e0da624c Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Fri, 19 Apr 2024 22:37:42 +0200 Subject: [PATCH 3/3] generate_packets.py: always transmit new elements in array-diff with variable length See RM #483 Signed-off-by: Alina Lenk --- common/generate_packets.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common/generate_packets.py b/common/generate_packets.py index 4b2bfcf060..c588cd4b4c 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -1439,6 +1439,26 @@ differ = FALSE; inner_cmp = prefix(" ", self.elem.get_code_cmp(sub)) index_put = prefix(" ", self.size.index_put(location.index)) index_put_sentinel = prefix(" ", self.size.index_put(self.size.real)) + + if not self.size.constant: + inner_cmp = f"""\ + if ({location.index} < {self.size.old}) {{ +{prefix(" ", inner_cmp)}\ + }} else {{ + /* Always transmit new elements */ + differ = TRUE; + }} +""" + inner_put_full = prefix(" ", self.elem.get_code_put(sub, False)) + if inner_put != inner_put_full: + inner_put = f"""\ + if ({location.index} < {self.size.old}) {{ +{prefix(" ", inner_put)}\ + }} else {{ +{prefix(" ", inner_put_full)}\ + }} +""" + return f"""\ {self.size.size_check_index(location.name)}\ {{ -- 2.34.1