__builtin_bcdsetsign

Purpose

Set the sign code of the input parameter in packed decimal format.

This built-in function is valid only when -qarch(-mcpu) is set to utilize the POWER9™ technology and the altivec.h file is included.

Prototype

vector unsigned char __builtin_bcdsetsign(vector unsigned char, unsigned char);

Usage

Returns the packed decimal value of the first parameter combined with the sign code.

The sign code is set according to the following rules:
  • If the packed decimal value of the first parameter is positive, the following rules apply:
    • If the second parameter is 0, the sign code is set to 0xC.
    • If the second parameter is 1, the sign code is set to 0xF.
  • If the packed decimal value of the first parameter is negative, the sign code is set to 0xD.
Notes:
  • The second parameter can only be 0 or 1.
  • You can determine whether a packed decimal value is positive or negative according to the following rules:
    • Packed decimal values with sign code of 0xA, 0xC, 0xE, or 0xF are interpreted as positive values.
    • Packed decimal values with sign code of 0xB or 0xD are interpreted as negative values.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us