[PATCH] score: Simplify _Objects_Is_api_valid()
Joel Sherrill
joel at rtems.org
Thu Mar 23 16:03:38 UTC 2023
On Thu, Mar 23, 2023 at 10:40 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:
> Close #4863.
> ---
> cpukit/include/rtems/score/objectimpl.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/cpukit/include/rtems/score/objectimpl.h
> b/cpukit/include/rtems/score/objectimpl.h
> index c58957ccb5..a1a87b5ccb 100644
> --- a/cpukit/include/rtems/score/objectimpl.h
> +++ b/cpukit/include/rtems/score/objectimpl.h
> @@ -542,9 +542,7 @@ static inline bool _Objects_Is_api_valid(
> uint32_t the_api
> )
> {
> - if ( !the_api || the_api > OBJECTS_APIS_LAST )
> - return false;
> - return true;
> + return ( 1 <= the_api && the_api <= OBJECTS_APIS_LAST );
> }
>
I'd really prefer we avoid compound logical expressions since it
becomes something that needs MCDC analysis at higher levels
of verification/qualification.
Please rewrite using simple logical expressions even if it means
two exit paths at the source leve. It's the same machine code.
--joel
>
> /**
> --
> 2.35.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230323/e2ca86d6/attachment.htm>
More information about the devel
mailing list