Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core/Include: Fix GCC __USAT() macro function + Improve USAT doc #1627

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CMSIS/Core/Include/cmsis_armcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
#define __USAT __usat

Expand Down Expand Up @@ -504,10 +504,10 @@ __attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint3

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
{
Expand Down
12 changes: 6 additions & 6 deletions CMSIS/Core/Include/cmsis_armclang.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
#define __USAT __builtin_arm_usat

Expand Down Expand Up @@ -550,10 +550,10 @@ __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
{
Expand Down
12 changes: 6 additions & 6 deletions CMSIS/Core/Include/cmsis_armclang_ltm.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@ __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
#define __USAT __builtin_arm_usat

Expand Down Expand Up @@ -542,10 +542,10 @@ __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
{
Expand Down
15 changes: 8 additions & 7 deletions CMSIS/Core/Include/cmsis_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,16 @@ __extension__ \

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] ARG1 Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] ARG1 Value to be saturated (signed)
\param [in] ARG2 Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
#define __USAT(ARG1, ARG2) \
__extension__ \
({ \
uint32_t __RES, __ARG1 = (ARG1); \
uint32_t __RES; \
int32_t __ARG1 = (ARG1); \
__ASM volatile ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) : "cc" ); \
__RES; \
})
Expand Down Expand Up @@ -730,10 +731,10 @@ __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
{
Expand Down
12 changes: 6 additions & 6 deletions CMSIS/Core/Include/cmsis_tiarmclang.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,10 @@ __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
#define __USAT __builtin_arm_usat

Expand Down Expand Up @@ -550,10 +550,10 @@ __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)

/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\details Saturates a signed value into an unsigned value.
\param [in] value Value to be saturated (signed)
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
\return Saturated value (unsigned)
*/
__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
{
Expand Down