12.33 __ssat16 intrinsic

This intrinsic inserts an SSAT16 instruction into the instruction stream generated by the compiler.

It enables you to saturate two signed 16-bit values to a selected signed range.

The Q bit is set if either operation saturates.

Syntax

unsigned int __saturate_halfwords(unsigned int val1, unsigned int val2)

Where:

val1

holds the two signed 16-bit values to be saturated

val2

is the bit position for saturation, an integral constant expression in the range 1 to 16.

Return value

The __ssat16 intrinsic returns:

  • The signed saturation of the low halfword in val1, saturated to the bit position specified in val2 and returned in the low halfword of the return value.

  • The signed saturation of the high halfword in val1, saturated to the bit position specified in val2 and returned in the high halfword of the return value.

Examples

unsigned int saturate_halfwords(unsigned int val1, unsigned int val2)
{
    unsigned int res;
    res = __ssat16(val1,val2); /* Saturate halfwords in val1 to the signed
                                  range specified by the bit position in val2 */
    return res;
}
Related reference
10.147 ARMv6 SIMD intrinsics
Related information
SSAT16
Saturating instructions
ARM and Thumb instruction summary
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.