Fehler #705
Von Maximilian Seesslen vor 1 Tag aktualisiert
Not very important. But at least some unit tests would be nice. And plausibilisation will make more sense. 201°C vs -55°C (Ref).
The integer values have just to be extended when signed; shifting is signed, nice.
<pre><code class="cpp">
if( raw & 0b1000'0000'0000 )
{
raw|=0b1111'1111'1111'1111'1111'0000'0000'0000;
}
int temp=( raw * 100.0 );
temp = temp >> 4;
</code></pre>
Alternatively 2 shift operators could be used; left/right. Check binary sizes on Eufa.
<pre><code class="cpp">
int raw=0b1100'1001'0000'0000; // RAW -55.0000
raw = ( raw<<16 ) >> (16+4);
</code></pre>
Hopefully ARM gcc make the same result
<pre><code class="cpp">
static_assert( ( -1 >> 1 ) == -1 );
</code></pre>
The integer values have just to be extended when signed; shifting is signed, nice.
<pre><code class="cpp">
if( raw & 0b1000'0000'0000 )
{
raw|=0b1111'1111'1111'1111'1111'0000'0000'0000;
}
int temp=( raw * 100.0 );
temp = temp >> 4;
</code></pre>
Alternatively 2 shift operators could be used; left/right. Check binary sizes on Eufa.
<pre><code class="cpp">
int raw=0b1100'1001'0000'0000; // RAW -55.0000
raw = ( raw<<16 ) >> (16+4);
</code></pre>
Hopefully ARM gcc make the same result
<pre><code class="cpp">
static_assert( ( -1 >> 1 ) == -1 );
</code></pre>