Skip to content

math: numbers: use const array arguments and add Doxygen documentation #11590

In review

Description

@tmleman

Sub-issue of #10110 (follow-up after the CMocka to ztest migration).

Problem

The vector helpers in src/math/numbers.c take their input arrays as non-const pointers although they only read them, and they are documented with plain comments instead of Doxygen:

int find_equal_int16(int16_t idx[], int16_t vec[], int n, int vec_length, int max_results);
int16_t find_min_int16(int16_t vec[], int vec_length);
int32_t find_max_abs_int32(int32_t vec[], int vec_length);

Callers that hold const data have to cast it away, and the parameters (for example the meaning of max_results <= 0) are not described in the generated documentation.

Original note in #10110: "Refactor functions in sof/src/math/numbers.c: constants as function arguments + update documentation".

Proposed change

  • Make the read-only array arguments const in src/math/numbers.c and src/include/sof/math/numbers.h
  • Add Doxygen comments (@brief, @param, @return) for the functions of numbers.c
  • Update the callers and the ztest suite test/ztest/unit/math/basic/arithmetic where needed

Acceptance criteria

  • No functional change, existing ztest suites pass
  • No new Doxygen warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions