<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Je to trochu složitější:-)<br>
<br>
int main(void) {<br>
<br>
uint64_t u64;<br>
while (1) {<br>
<br>
//u64=0ULL;<br>
//u64 <<= 8; u64 |= SIGROW.SERNUM5;<br>
u64 <<= 8; u64 = SIGROW.SERNUM5;<br>
<br>
u64 <<= 8; u64 |= SIGROW.SERNUM4;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM3;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM2;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM1;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM0;<br>
<br>
// aby byla jistota, že to celý neodoptimalizuje<br>
u64++;<br>
for (uint8_t n=0; n<8; n++) {<br>
PORTA.OUT = *(((uint8_t *)&u64)+1);<br>
}<br>
}<br>
}<br>
<br>
Zakomentovaná varianta 444 B, vylepšená 478.<br>
<br>
Až po odmazání prvního u64 <<= 8; se to zlepší na 442 a
původní zůstane na 444.<br>
<br>
Takže nakonec je to o 2 B lepší. Ale zas ta původní varianta má
snadno modifikovatelné pořadí, což byla základní myšlenka proč jsem
to tak napsal.<br>
<br>
PH<br>
<br>
<br>
<div class="moz-cite-prefix">Dne 18.12.2024 v 16:53 Petr Labaj
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:4f95f9f2-9005-bf7d-f2eb-d80a83445f04@volny.cz">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Je zajímavé, že jste oba použili podobnou konstrukci, která je
podle mě suboptimální.<br>
Když už jste teda zvolili ty shifty místo nějakých rychlejších
možností.<br>
<br>
První řádek by měl být podle mě dosazovací.<br>
<br>
Tedy nějak takto:<br>
<div><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">adc_value = (</span><span
class="gmail-hljs-type"
style="font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">long</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">)d[</span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">0</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">] << </span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">24</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">;</span></div>
<span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">adc_value += (</span><span
class="gmail-hljs-type"
style="font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">long</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">)d[</span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">1</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">] << </span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">16</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">;
</span>...<br>
<br>
A u pana Hudečka ještě bez toho úvodního nulování:<br>
u64 <<= 8; u64 = SIGROW.SERNUM5;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM4;<br>
...<br>
<br>
PL<br>
<br>
******************<br>
<br>
<div class="moz-cite-prefix">Dne 18.12.2024 v 9:56 Jirka Mww
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:CAGNMtu1-nEO3Z9v+TiaMPnPVX5k2JofaEadjw2T5iktqqSTKcw@mail.gmail.com">
<meta http-equiv="content-type"
content="text/html; charset=UTF-8">
<div dir="ltr"><br>
<div><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)"> adc_value += (</span><span
class="gmail-hljs-type"
style="font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">long</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">)d[</span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">0</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">] << </span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">24</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">;</span></div>
<span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)"> adc_value += (</span><span
class="gmail-hljs-type"
style="font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">long</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">)d[</span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">1</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">] << </span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">16</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">;
adc_value += (</span><span class="gmail-hljs-type"
style="font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">long</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">)d[</span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">2</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">] << </span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">8</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">; </span>
<div><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)"> adc_value += (</span><span
class="gmail-hljs-type"
style="font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">long</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">)d[</span><span
class="gmail-hljs-number"
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre">3</span><span
style="color:rgb(67,67,67);font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace;font-size:14px;white-space:pre;background-color:rgb(248,248,248)">];</span> </div>
<div><br>
</div>
</div>
</blockquote>
<br>
<div class="moz-cite-prefix">Dne 18.12.2024 v 13:26 Pavel Hudeček
napsal(a):<br>
</div>
<blockquote type="cite"
cite="mid:8c3af9ca-7222-42f3-9648-268c40377070@seznam.cz">
u64=0ULL;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM5;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM4;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM3;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM2;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM1;<br>
u64 <<= 8; u64 |= SIGROW.SERNUM0;<br>
</blockquote>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre wrap="" class="moz-quote-pre">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<br>
</body>
</html>