@Override
		public int compare(Object o1, Object o2) {
			if (o1 instanceof Integer) {
				return -compare(o2, o1);
			}
			DataTypeComponent dtc = (DataTypeComponent) o1;
			int bitOffset = ((Integer) o2).intValue();

			int startBit, endBit;
			if (dtc.isBitFieldComponent()) {
				BitFieldDataType bitfield = (BitFieldDataType) dtc.getDataType();
				startBit = getNormalizedBitfieldOffset(dtc.getOffset(), dtc.getLength(),
					bitfield.getBitSize(), bitfield.getBitOffset(), bigEndian);
				endBit = startBit + bitfield.getBitSize() - 1;
			}
			else {
				startBit = 8 * dtc.getOffset();
				endBit = startBit + (8 * dtc.getLength()) - 1;
			}

			if (bitOffset < startBit) {
				return 1;
			}
			if (bitOffset > endBit) {
				return -1;
			}
			return 0;
		}
<code>BitOffsetComparator</code> provides ability to compare an normalized bit offset (see
{@link #getNormalizedBitfieldOffset(int, int, int, int, boolean)}) with a
{@link DataTypeComponent} object. The offset will be considered equal (0) if the component
contains the offset. A normalized component bit numbering is used to establish the footprint
of each component with an ordinal-based ordering (assumes specific LE/BE allocation rules).
Bit offsets for this comparator number the first allocated bit of the structure as 0 and the
last allocated bit of the structure as (8 * structLength) - 1. For big-endian bitfields the
msb of the bitfield will be assigned the lower bit-number (assumes msb-allocated-first),
while little-endian will perform similar numbering assuming byte-swap and bit-reversal of the
storage unit (assumes lsb-allocated-first). Both cases result in a normalized view where
normalized bit-0 is allocated first.

<pre>
{@literal
Example:
   
Big-Endian (normalized view):
   | . . . . . . . 7 | 8 9 . . . . . . |
   |<--------------------------------->| storage-size (2-bytes)
                       |<--------------| bit-offset (6, lsb position within storage unit)
                   |<--->|               bit-size (3)
                       
Little-Endian (normalized view, w/ storage byte-swap and bit-reversal):
   | . . . . . . 6 7 | 8 . . . . . . . |
   |------------>|                       bit-offset (6, lsb position within storage unit)
                 |<--->|                 bit-size (3)
}
</pre>
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/Structure.java