public final boolean equalTo ( MemorySegment seg2 , int offset1 , int offset2 , int length ) { int i = 0 ; // we assume unaligned accesses are supported. // Compare 8 bytes at a time. while ( i <= length - 8 ) { if ( getLong ( offset1 + i ) != seg2 . getLong ( offset2 + i ) ) { return false ; } i += 8 ; } // cover the last (length % 8) elements. while ( i < length ) { if ( get ( offset1 + i ) != seg2 . get ( offset2 + i ) ) { return false ; } i += 1 ; } return true ; }
Equals two memory segment regions .