From 0985b100104929001219d414e06b7e212b37018d Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Thu, 20 Aug 2026 06:59:49 -0400 Subject: [PATCH] GP-0: Certify --- .../slghpatexpress/EqualEquation.java | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slghpatexpress/EqualEquation.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slghpatexpress/EqualEquation.java index ed37d5e284..46d891bffa 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slghpatexpress/EqualEquation.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slghpatexpress/EqualEquation.java @@ -1,13 +1,12 @@ /* ### * IP: GHIDRA - * REVIEWED: YES * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,46 +16,48 @@ package ghidra.pcodeCPort.slghpatexpress; import generic.stl.VectorSTL; -import ghidra.pcodeCPort.context.*; +import ghidra.pcodeCPort.context.SleighError; import ghidra.sleigh.grammar.Location; public class EqualEquation extends ValExpressEquation { - public EqualEquation(Location location, PatternValue l, PatternExpression r) { - super(location, l, r); - } + public EqualEquation(Location location, PatternValue l, PatternExpression r) { + super(location, l, r); + } - static boolean isValueInRange(long value, long min, long max) { - return Long.compareUnsigned(value, min) >= 0 && Long.compareUnsigned(value, max) <= 0; - } + static boolean isValueInRange(long value, long min, long max) { + return Long.compareUnsigned(value, min) >= 0 && Long.compareUnsigned(value, max) <= 0; + } - @Override - public void genPattern(VectorSTL ops) { - long lhsmin = lhs.minValue(); - long lhsmax = lhs.maxValue(); - VectorSTL semval = new VectorSTL(); - VectorSTL min = new VectorSTL(); - VectorSTL max = new VectorSTL(); - VectorSTL cur = new VectorSTL(); - int count = 0; + @Override + public void genPattern(VectorSTL ops) { + long lhsmin = lhs.minValue(); + long lhsmax = lhs.maxValue(); + VectorSTL semval = new VectorSTL(); + VectorSTL min = new VectorSTL(); + VectorSTL max = new VectorSTL(); + VectorSTL cur = new VectorSTL(); + int count = 0; - rhs.listValues(semval); - rhs.getMinMax(min, max); - cur = min.copy(); + rhs.listValues(semval); + rhs.getMinMax(min, max); + cur = min.copy(); - do { - long val = rhs.getSubValue(cur); - if (isValueInRange(val, lhsmin, lhsmax)) { - if (count == 0) - setTokenPattern(ExpressUtils.buildPattern(lhs, val, semval, cur)); - else - setTokenPattern(getTokenPattern().doOr(ExpressUtils.buildPattern(lhs, val, semval, cur))); - count += 1; - } - } while (ExpressUtils.advance_combo(cur, min, max)); - if (count == 0) { - throw new SleighError("Equal constraint is impossible to match", location); - } - } + do { + long val = rhs.getSubValue(cur); + if (isValueInRange(val, lhsmin, lhsmax)) { + if (count == 0) + setTokenPattern(ExpressUtils.buildPattern(lhs, val, semval, cur)); + else + setTokenPattern( + getTokenPattern().doOr(ExpressUtils.buildPattern(lhs, val, semval, cur))); + count += 1; + } + } + while (ExpressUtils.advance_combo(cur, min, max)); + if (count == 0) { + throw new SleighError("Equal constraint is impossible to match", location); + } + } }