From d0e68f4d7ba0a374e31a5e46d24da969b203497c Mon Sep 17 00:00:00 2001 From: Willem Date: Thu, 7 Aug 2025 17:44:54 +0200 Subject: [PATCH] FC18: Fixed NCR1632 max value check --- .../src/main/java/org/x4o/fc18/FourCornerRecipe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java index f126815..54d7484 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerRecipe.java @@ -134,7 +134,7 @@ final public class FourCornerRecipe { } static final private BigInteger NCR1632_MASK_PAGE = BigInteger.valueOf(0x1FF); - static final private BigInteger NCR1632_MASK_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16); + static final private BigInteger NCR1632_VALUE_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16); static private List embedNCR1632Value(List result, BigInteger value, int bankStart) { if (value.equals(BigInteger.ZERO)) { @@ -143,7 +143,7 @@ final public class FourCornerRecipe { //if (value.signum() == -1) { // // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options //} - if (value.and(NCR1632_MASK_MAX).equals(BigInteger.ZERO)) { + if (value.compareTo(NCR1632_VALUE_MAX) > 0) { throw new IllegalArgumentException("Value is larger than 576 bit: " + value); } BigInteger valueZero = value.subtract(BigInteger.ONE);