12.56 __usat16 intrinsic

This intrinsic inserts a USAT16 instruction into the instruction stream generated by the compiler.

It enables you to saturate two signed 16-bit values to a selected unsigned range. The Q flag is set if either operation saturates.

Syntax

unsigned int __usat16(unsigned int val1, /* constant */ unsigned int val2)
Where:
val1
holds the two 16-bit values that are to be saturated
val2
specifies the bit position for saturation, and must be an integral constant expression.

Return value

The __usat16 intrinsic returns the saturation of the two signed 16-bit values, as non-negative values.

Examples

unsigned int saturate_halfwords(unsigned int val1)
{
    unsigned int res;
    #define VAL2 12
    res = __usat16(val1,VAL2); /* Saturate halfwords in val1 to the unsigned 
                                range specified by the bit position in VAL2
                              */    
    return res;
}
Related reference
9.143 ARMv6 SIMD intrinsics
Related information
USAT16
ARM and Thumb instruction summary
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.