<div dir="ltr"><div dir="ltr">Thanks Michael,<br><div>I hadn't considered there would be an essay in the commit, thanks for that - though it doesn't shed a lot of light on the situation</div><div><br></div><div>There seems to be 2 places that mark a Name using the high bit, and only one place that kinda-sorta reads it. </div><div><br></div><div>The Name is 'marked' during populate() which seems to be to mark each name with a '*' and the high-bit, before going through and getting the current names for the processes - adding new ones and replacing the old ones without '*' and high-bit mark. So items which are double marked are effectively stale/historic.</div><div><br></div><div>It is also 'marked' during the find call .. which basically marks the 'found' name if it was not found and then constructed. The does not appear to be any purpose to this that I can ascertain.</div><div><br></div><div>The one place (afaict) it reads the value is in zero() below - the problem is that it looks at the entire top uint32 rather than just that high byte!! It's hard to work out whether this is just a long-standing bug or whether it is weeding out names > 12 characters as well from being removed.</div><div>So this seems to remove an item from the map, but only if it isn't marked (or long) ie if it isn't stale - or been 'seen' I guess?</div><div><br></div><div> <font face="monospace">bool zero(TaskHandle_t taskid)<br> {<br> for (int i = 0; i < count; ++i)<br> {<br> if (map[i].id == taskid)<br> {<b><br> if (map[i].name.words[NAMELEN/4-1] > 0)</b><br> return false;<br> for (++i ; i < count; ++i)<br> {<br> map[i-1] = map[i];<br> }<br> --count;<br> return true;<br> }<br> }<br> return false;<br> }<br></font></div><div><br></div><div>Does this help? Any thoughts on what this was meant to do ? I've CCd Stephen with a hope he might chip in?</div><div> </div><div>//.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 24 Jan 2024 at 15:09, Michael Balzer <<a href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
Michael,<br>
<br>
Am 21.01.24 um 02:54 schrieb Michael Geddes:<br>
<blockquote type="cite">
<div dir="ltr">Hey, In working trying to get ESP-IDF 5+ Working, I
came across the following fun thing that I'm trying to work out
what is going on!!
<div>This is from main/ovms_module.cpp</div>
<div>I'm not sure why we don't just go through all the words and
compare - why the masked compare for the last entry! And why
that value?? It might make sense if you masked out the final
byte ... I'm just struggling to understand.</div>
</div>
</blockquote>
<br>
From the further accesses to the last word/byte in TaskMap, I'd
guess Steve intended using the sign bit on the last byte as some
special indicator, but it's not clear to me for what purpose. It
also doesn't seem to be relevant anymore.<br>
<br>
Steve's commit message is verbose
(30d0a403a380e797f9b222b01dab8da791ab388c), and maybe you can find
some more explanation in the list archives.<br>
<br>
Regards,<br>
Michael<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>Why am I looking at it?? Well there's a new warning about
copy constructors.. and then I ran into a problem where 'Name'
is sometimes in memory that can only be accessed 32bit int
aligned (which is why the strange implementation in the first
place - I get that).</div>
<div><br>
</div>
<div>Can anybody shed any light on this?</div>
<div><br>
</div>
<div><br>
<div>class Name<br>
{.......<br>
</div>
<div> inline bool operator==(const Name& a) const<br>
{<br>
for (int i = 0; i < NAMELEN/4 - 1; ++i)<br>
if (a.words[i] != words[i]) return false;<br>
i<b>f (a.words[NAMELEN/4-1] != (words[NAMELEN/4-1]
& 0x7FFFFFFF)) return false;</b><br>
return true;<br>
}<br>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
OvmsDev mailing list
<a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank">OvmsDev@lists.openvehicles.com</a>
<a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" target="_blank">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
</div>
_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.openvehicles.com" target="_blank">OvmsDev@lists.openvehicles.com</a><br>
<a href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev" rel="noreferrer" target="_blank">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a><br>
</blockquote></div></div>