@@ -5178,37 +5178,37 @@ J9::Z::TreeEvaluator::zdchkEvaluator(TR::Node *node, TR::CodeGenerator *cg)
51785178 * - Leading Sign (LS) : 1 if sign is leading, otherwise 0 for trailing sign.
51795179 * - Disallowed-Spaces Count (DSC): DC is total number of digits, DSC represents number of digits
51805180 * with zone and digit format, rest can have space.
5181- * Only relevant when LS and SSC are 0.
5181+ * Only relevant when SSC is 0.
51825182 * - Sign-Test Control (STC) : Specifies which codes are considered as valid sign codes.
51835183 * 110 (C,D,F) for embedded sign (will return false for non-preferred sign codes).
51845184 * 010 (4e,60) for sign separate (leading/trailing).
51855185 * 000 all sign codes are considered valid (hex) (A-F).
51865186 * - Digits Count (DC) : Integer specifying number of bytes to be verified. Does not include sign byte.
51875187 */
5188- uint16_t zonedDecimalInfo = 0x0 ; // I3 operandgit d
5189- uint8_t stc = 0x0 ;
5188+ #define I3_SSC_SEPARATE 0x1
5189+ #define I3_STC_SIGN_SEPARATE 0x2
5190+ #define I3_LS_LEADING 0x1
5191+ #define I3_STC_EMBEDDED_SIGN 0x6
51905192
5193+ uint16_t zonedDecimalInfo = static_cast <uint16_t >(precision); // I3 operand
51915194 int8_t dsc = static_cast <int8_t >(precision - bytesWithSpacesConst);
51925195
51935196 if (dataType == TR::ZonedDecimalSignTrailingSeparate) // Sign trailing separate
51945197 {
5195- zonedDecimalInfo = 0x2 ; // set SSC bit
5196- stc = 0x2 ;
5197- dsc = 0x0 ;
5198+ zonedDecimalInfo |= ((I3_SSC_SEPARATE << 14 ) | (I3_STC_SIGN_SEPARATE << 5 ));
51985199 }
51995200 else if (dataType == TR::ZonedDecimalSignLeadingEmbedded) // Sign leading embedded
52005201 {
5201- zonedDecimalInfo = 0x1 ; // set LC bit
5202+ zonedDecimalInfo |= ((I3_LS_LEADING << 13 ) | (dsc << 8 ));
52025203 }
52035204 else if (dataType == TR::ZonedDecimalSignLeadingSeparate) // Sign leading separate
52045205 {
5205- zonedDecimalInfo = 0x3 ; // set SSC and LS bits
5206- stc = 0x2 ;
5207- dsc = 0x0 ;
5206+ zonedDecimalInfo |= ((I3_SSC_SEPARATE << 14 ) | (I3_LS_LEADING << 13 ) | (I3_STC_SIGN_SEPARATE << 5 ));
5207+ }
5208+ else if (dataType == TR::ZonedDecimal) // Sign embedded trailing
5209+ {
5210+ zonedDecimalInfo |= (dsc << 8 );
52085211 }
5209- zonedDecimalInfo = (zonedDecimalInfo << 5 ) | dsc;
5210- zonedDecimalInfo = (zonedDecimalInfo << 3 ) | stc;
5211- zonedDecimalInfo = (zonedDecimalInfo << 5 ) | precision; // DC
52125212
52135213 // Must use decimalLength because precision does not equal length when sign is separate
52145214 int8_t firstByteIndexToLoad = decimalLength - 1 ;
@@ -5243,7 +5243,7 @@ J9::Z::TreeEvaluator::zdchkEvaluator(TR::Node *node, TR::CodeGenerator *cg)
52435243 node->setRegister (chkResultReg);
52445244 cg->decReferenceCount (child);
52455245 cg->decReferenceCount (node->getSecondChild ());
5246- cg->traceBCDExit (" zdchk" ,node);
5246+ cg->traceBCDExit (" zdchk" , node);
52475247 return chkResultReg;
52485248 }
52495249
0 commit comments