You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your enhancement proposal related to a problem? Please describe.
It would be nice if the minimal libc supported qsort() within the stdlib area.
Implementation it via qsort_s() (C11) would probably make sense.
Since it's a global / standard C symbol, it could be enabled by default, as the linker would discard it if unused.
Describe the solution you'd like
A simple implementation of qsort_s() and qsort() via the former.
It might also make sense to define qsort() in terms of C11 generics so that e.g. an 8-bit, 16-bit, 32-bit, or 64-bit optimized version could be used when appropriate, and a generic memcpy() version could be used for objects beyond the size of normal integers. If so, then there would likely need to be a caveat, that any elements would be required to be aligned to their natural boundaries, if there is not one already.
Describe alternatives you've considered
There is a BSD-licensed implementation available from NuttX. I'm currently using it in Greybus for Zephyr, although I think it would be fine to write a less cryptic version.
Additional context
The text was updated successfully, but these errors were encountered:
Is your enhancement proposal related to a problem? Please describe.
It would be nice if the minimal libc supported qsort() within the stdlib area.
Implementation it via
qsort_s()
(C11) would probably make sense.Since it's a global / standard C symbol, it could be enabled by default, as the linker would discard it if unused.
Describe the solution you'd like
A simple implementation of
qsort_s()
andqsort()
via the former.It might also make sense to define
qsort()
in terms of C11 generics so that e.g. an 8-bit, 16-bit, 32-bit, or 64-bit optimized version could be used when appropriate, and a genericmemcpy()
version could be used for objects beyond the size of normal integers. If so, then there would likely need to be a caveat, that any elements would be required to be aligned to their natural boundaries, if there is not one already.Describe alternatives you've considered
There is a BSD-licensed implementation available from NuttX. I'm currently using it in Greybus for Zephyr, although I think it would be fine to write a less cryptic version.
Additional context
The text was updated successfully, but these errors were encountered: