__builtin_packed2zoned

Purpose

Transforms the packed decimal value to zoned decimal format.

Note: This built-in function is valid only when the following conditions are met:
  • The -mcpu option is set to target POWER9 processors or higher.
  • The bcd.h file is included.

Prototype

vector unsigned char __builtin_packed2zoned(vector unsigned char, unsigned char);

Usage

The built-in function transforms the packed decimal value to zoned decimal format. The format of the result depends on the value of the second parameter and complies with the following rules:
  • If the second parameter is 0, the format of the result is set by the following rules:
    • The leftmost halfword of each digit 0-14 of the result is set to 0x3.
    • The positive sign code is set to 0x3.
    • The negative sign code is set to 0x7.
  • If the second parameter is 1, the format of the result is set by the following rules:
    • The leftmost halfword of each digit 0-14 of the result is set to 0xF.
    • The positive sign code is set to 0xC.
    • The negative 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.