| 383d0594 | 17-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
libutils: util.h: fix indentation of ROUNDDOWN() macro
Fix indentation of the value defined for ROUNDDOWN() macro and add inline comment to better highlight the surrounded macros are defined for ass
libutils: util.h: fix indentation of ROUNDDOWN() macro
Fix indentation of the value defined for ROUNDDOWN() macro and add inline comment to better highlight the surrounded macros are defined for assembler and like source files.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| fa418fcd | 18-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
libutils: util.h: Relax ROUNDDOWN() and add ROUNDDOWN2()
Remove constraint on ROUNDDOWN() to have its size argument being a power of 2 and add new ROUNDDOWN2() macro with that constraint.
The previ
libutils: util.h: Relax ROUNDDOWN() and add ROUNDDOWN2()
Remove constraint on ROUNDDOWN() to have its size argument being a power of 2 and add new ROUNDDOWN2() macro with that constraint.
The previous implementation of ROUNDDOWN(), optimized for when size argument is a power of 2, is now used for ROUNDDOWN2() but this latter also asserts (in debug build mode) that the size argument conforms to this condition.
The new implementation of ROUNDDOWN() is less optimal but modern compilers produce the same optimized assembly code with this macro when the size argument is a constant value known from the compiler so all use of ROUNDDOWN() with a known constant value do not need move to ROUNDDOWN2().
Performance sensitive routines should now on use ROUNDDOWN2() to leverage the power-of-2 rounding optimization.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8132f3be | 18-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
libutils: util.h: Relax ROUNDUP() and add ROUNDUP2()
Remove constraint on ROUNDUP() to have its size argument being a power of 2 and add new ROUNDUP2() macro with that constraint.
The previous impl
libutils: util.h: Relax ROUNDUP() and add ROUNDUP2()
Remove constraint on ROUNDUP() to have its size argument being a power of 2 and add new ROUNDUP2() macro with that constraint.
The previous implementation of ROUNDUP(), optimized for when size argument is a power of 2, is now used for ROUNDUP2() but this latter also asserts (in debug build mode) that the size argument conforms to this condition.
The new implementation of ROUNDUP() is less optimal but modern compilers produce the same optimized assembly code with this macro when the size argument is a constant value known from the compiler so all use of ROUNDUP() with a known constant value do not need move to ROUNDUP2().
Performance sensitive routines should now on use ROUNDUP2() to leverage the power-of-2 rounding optimization.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c98faf4d | 18-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
libutils: util.h: Relax ROUNDUP_OVERFLOW() and add ROUNDUP2_OVERFLOW()
Remove constraint on ROUNDUP_OVERFLOW() to have its size argument being a power of 2 and add new ROUNDUP2_OVERFLOW() macro with
libutils: util.h: Relax ROUNDUP_OVERFLOW() and add ROUNDUP2_OVERFLOW()
Remove constraint on ROUNDUP_OVERFLOW() to have its size argument being a power of 2 and add new ROUNDUP2_OVERFLOW() macro with that constraint.
The previous implementation of ROUNDUP_OVERFLOW(), optimized for when size argument is a power of 2, is now used for ROUNDUP2_OVERFLOW() but this latter also asserts (in debug build mode) that the size argument conforms to this condition.
Performance sensitive routines should now on use ROUNDUP2_OVERFLOW() to leverage the power-of-2 rounding optimization.
The new implementation of ROUNDUP_OVERFLOW() is less optimal but modern compilers produce the same optimized assembly code with this macro when the size argument is a constant value known from the compiler so all use of ROUNDUP_OVERFLOW() with a known constant value do not need move to ROUNDUP2_OVERFLOW().
By the way, fix the indentation in the macro implementation for consistency of the header file implementation and extend the inline description comment.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4879d4c0 | 16-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
libutils: util.h: Relax ROUNDUP_DIV() and add ROUNDUP2_DIV()
Remove constraint on ROUNDUP_DIV() to have its size argument being a power of 2 and add new ROUNDUP2_DIV() macro with that constraint.
T
libutils: util.h: Relax ROUNDUP_DIV() and add ROUNDUP2_DIV()
Remove constraint on ROUNDUP_DIV() to have its size argument being a power of 2 and add new ROUNDUP2_DIV() macro with that constraint.
The previous implementation of ROUNDUP_DIV(), optimized for when size argument is a power of 2, is now used for ROUNDUP2_DIV() but this latter also asserts (in debug build mode) that the size argument conforms to this condition.
Performance sensitive routines should now on use ROUNDUP2_DIV() to leverage the power-of-2 rounding optimization.
The new implementation of ROUNDUP_DIV() is less optimal but modern compilers produce the same optimized assembly code with this macro when the size argument is a constant value known from the compiler so all use of ROUNDUP_DIV() with a known constant value do not need move to ROUNDUP2_DIV().
By the way, fix the indentation in the macro implementation for consistency of the header file implementation.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|