Skip to content

Commit 0b9e141

Browse files
committed
Add segmentsOverlap method to jdk1.4 Arrays class
1 parent 134689f commit 0b9e141

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/src/main/jdk1.4/org/bouncycastle/util/Arrays.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,14 @@ public static int hashCode(Object[] data)
11451145
return hc;
11461146
}
11471147

1148+
public static boolean segmentsOverlap(int aOff, int aLen, int bOff, int bLen)
1149+
{
1150+
return aLen > 0
1151+
&& bLen > 0
1152+
&& aOff - bOff < bLen
1153+
&& bOff - aOff < aLen;
1154+
}
1155+
11481156
public static void validateSegment(byte[] buf, int off, int len)
11491157
{
11501158
if (buf == null)

0 commit comments

Comments
 (0)