Class AsmUtil
java.lang.Object
ghidra.app.plugin.assembler.sleigh.util.AsmUtil
Utilities for the Assembler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
compareArrays
(byte[] a, byte[] b) Compare two byte arrays by their corresponding entriesstatic <T extends Comparable<T>>
intcompareInOrder
(Collection<T> a, Collection<T> b) Compare two collections by their corresponding elements in orderstatic <T> List
<T> extendList
(List<T> list, T ext) Extend a list with the given item
-
Constructor Details
-
AsmUtil
public AsmUtil()
-
-
Method Details
-
compareInOrder
Compare two collections by their corresponding elements in orderIf the collections have differing sizes, the ordering does not matter. The smaller collection precedes the larger. Otherwise, each corresponding pair of elements are compared. Once an unequal pair is found, the collections are ordered by those elements. This is analogous to
String
comparison.- Parameters:
a
- the first setb
- the second set- Returns:
- a comparison result as in
Comparable.compareTo(Object)
-
compareArrays
public static int compareArrays(byte[] a, byte[] b) Compare two byte arrays by their corresponding entriesIf the two arrays have differing lengths, the shorter precedes the longer. Otherwise, they are compared as in C's
memcmp
, except that Javabyte
s are signed.- Parameters:
a
- the first arrayb
- the second array- Returns:
- a comparison result as in
Comparable.compareTo(Object)
-
extendList
Extend a list with the given itemUsed in functional style when the list is immutable.
- Type Parameters:
T
- the type of elements- Parameters:
list
- the listext
- the additional item- Returns:
- an immutable copy of the list with the given item appended
-