Skip to content

Conversation

@soburi
Copy link
Member

@soburi soburi commented Jan 19, 2025

Gets the specified number of elements from the beginning of the list.
This is the symmetircal operation as GET_ARGS_LESS_N.

_47, _48, _49, _50, _51, _52, _53, _54, _55, \
_56, _57, _58, _59, _60, _61, _62, _63, ...) __VA_ARGS__

#define Z_GET_ARGS_FIRST_0(...)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the implementation is straightforward.
I'd be happy to hear any comments on whether you think the name is preferable.

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Mar 21, 2025
soburi added 2 commits March 24, 2025 06:18
Gets the specified number of elements from the beginning of the list.
This is the symmetircal operation as `GET_ARGS_LESS_N`.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Add `GET_ARGS_FIRST_N` tests.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@soburi soburi force-pushed the add_get_args_first_n branch from eb9b927 to 07f82da Compare March 23, 2025 21:20
@github-actions github-actions bot removed the Stale label Mar 24, 2025
Copy link
Contributor

@yperess yperess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if you could demonstrate a use in tree. Why do we need this?

@soburi
Copy link
Member Author

soburi commented Mar 25, 2025

@yperess

I would prefer if you could demonstrate a use in tree. Why do we need this?

This is a basic list operation, so it can be used in various ways, but the most typical use is to extract a sublist from a list.
I've cut it out into this PR because it's an easy chunk to review.

https://github.com/zephyrproject-rtos/zephyr/pull/87595/files#diff-d5eb7802a9e704874c7a8b2a39bcc2c06899d6f59fd169555f9f2dd1f7b8cd93R17-R18

#define DT_MAP_HELPER_DO_ARGS_RANGE(start, len, ...)                                               \
        GET_ARGS_FIRST_N(len, GET_ARGS_LESS_N(start, __VA_ARGS__))
#define NUM_0to7 0, 1, 2, 3, 4, 5, 6, 7

DT_MAP_HELPER_DO_ARGS_RANGE(4, 2, NUM_0to7) // 4, 5

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label May 25, 2025
@github-actions github-actions bot closed this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Base OS Base OS Library (lib/os) area: Testsuite Testsuite Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants