Skip to content

Commit

Permalink
sa fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
camilo committed Feb 13, 2024
1 parent 52295d4 commit eabfe70
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion qbitfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "qbitfield.h"
#include <string.h>

static const size_t qBitField_LBit = (size_t)( sizeof(uint32_t) * 8u );
static const size_t qBitField_LBit = (size_t)( sizeof(uint32_t) * 8U );

static uint32_t qBitField_Mask( const size_t index );
static size_t qBitField_BitSlot( const size_t index );
Expand Down
2 changes: 1 addition & 1 deletion qffmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static float qFFMath_CalcCbrt( float x , bool r )
}
/*cppcheck-suppress misra-c2012-21.15 */
cast_reinterpret( i, x, uint32_t );
i = 0x548C2B4Bu - ( i/3U );
i = 0x548C2B4BU - ( i/3U );
/*cppcheck-suppress misra-c2012-21.15 */
cast_reinterpret( y, i, float );
c = x*y*y*y;
Expand Down
4 changes: 2 additions & 2 deletions qfis.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static size_t qFIS_InferenceConsequent( struct _qFIS_s * const f,

outIndex = f->rules[ i ];
MFOutIndex = f->rules[ i + 1U ];
connector = ( f->nOutputs > 1U )? f->rules[ i + 2u ] : -1;
connector = ( f->nOutputs > 1U )? f->rules[ i + 2U ] : -1;
if ( MFOutIndex < 0 ) {
MFOutIndex = -MFOutIndex;
neg = 1U;
Expand Down Expand Up @@ -579,7 +579,7 @@ static size_t qFIS_InferenceConsequent( struct _qFIS_s * const f,
}
}

i += 2u;
i += 2U;
if ( _QFIS_AND != connector ) {
f->aggregationState = &qFIS_AggregationFindConsequent;
++f->ruleCount;
Expand Down
2 changes: 1 addition & 1 deletion qfmathex.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool qFMathEx_InPolygon( const float x,
bool retVal = false;
float max_y = py[ 0 ], max_x = px[ 0 ], min_y = py[ 0 ], min_x = px[ 0 ];

for ( i = 0u ; i < p ; ++i ) {
for ( i = 0U ; i < p ; ++i ) {
max_y = QLIB_MAX( py[ i ], max_y );
max_x = QLIB_MAX( px[ i ], max_x );
min_y = QLIB_MIN( py[ i ], min_y );
Expand Down
18 changes: 9 additions & 9 deletions qfp16.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ static const struct _qFP16_intern_s intern = {
/*f_16*/ 1048576,
/*f_100*/ 6553600,
/*f_6_5*/ 425984,
/*one_fp16_f*/ 0.0000152587890625f,
/*one_fp16_f*/ 0.0000152587890625F,
/*one_fp16_d*/ 0.0000152587890625,
/*overflow_mask*/ 0x80000000U,
/*fraction_mask*/ 0x0000FFFFu,
/*fraction_mask*/ 0x0000FFFFU,
/*integer_mask*/ 0xFFFF0000U
};

Expand Down Expand Up @@ -150,7 +150,7 @@ qFP16_t qFP16_FloatToFP( const float x )
retValue = x * (float)qFP16.one;
/*cstat +CERT-FLP36-C*/
if ( 1U == fp->rounding ) {
retValue += ( retValue >= 0.0f) ? 0.5f : -0.5f;
retValue += ( retValue >= 0.0F ) ? 0.5F : -0.5F;
}

return (qFP16_t)retValue;
Expand Down Expand Up @@ -377,12 +377,12 @@ qFP16_t qFP16_Sqrt( qFP16_t x )

retValue = 0;
/*cppcheck-suppress [ cert-INT31-c, misra-c2012-12.2, misra-c2012-12.1 ]*/
bit = ( 0 != ( x & (qFP16_t)4293918720 ) ) ? ( 1U << 30U ) : ( 1U << 18u );
bit = ( 0 != ( x & (qFP16_t)4293918720 ) ) ? ( 1U << 30U ) : ( 1U << 18U );
while ( bit > (uint32_t)x ) {
bit >>= 2u;
bit >>= 2U;
}

for ( n = 0U ; n < 2u ; ++n ) {
for ( n = 0U ; n < 2U ; ++n ) {
while ( 0U != bit ) {
/*cppcheck-suppress misra-c2012-10.8 */
if ( x >= (qFP16_t)( (uint32_t)retValue + bit ) ) {
Expand All @@ -395,7 +395,7 @@ qFP16_t qFP16_Sqrt( qFP16_t x )
/*cppcheck-suppress misra-c2012-10.1 */
retValue = ( retValue >> 1 );
}
bit >>= 2u;
bit >>= 2U;
}

if ( 0U == n ) {
Expand Down Expand Up @@ -892,8 +892,8 @@ qFP16_t qFP16_AToFP( const char *s )
iPart += digit;
++count;
overflow = ( ( 0 == count ) || ( count > 5 ) ||
( iPart > 32768u ) ||
( ( 0U == neg ) && ( iPart > 32767u ) ) );
( iPart > 32768U ) ||
( ( 0U == neg ) && ( iPart > 32767U ) ) );
}
}
else {
Expand Down

0 comments on commit eabfe70

Please sign in to comment.