@@ -497,22 +497,16 @@ impl OpcodeDispatcher {
497
497
}
498
498
} ) ,
499
499
SreOpcode :: IN => once ( |drive| {
500
- general_op_in ( drive, |x| x ) ;
500
+ general_op_in ( drive, |set , c| charset ( set , c ) ) ;
501
501
} ) ,
502
502
SreOpcode :: IN_IGNORE => once ( |drive| {
503
- general_op_in ( drive, lower_ascii) ;
503
+ general_op_in ( drive, |set , c| charset ( set , lower_ascii ( c ) ) ) ;
504
504
} ) ,
505
505
SreOpcode :: IN_UNI_IGNORE => once ( |drive| {
506
- general_op_in ( drive, lower_unicode) ;
506
+ general_op_in ( drive, |set , c| charset ( set , lower_unicode ( c ) ) ) ;
507
507
} ) ,
508
508
SreOpcode :: IN_LOC_IGNORE => once ( |drive| {
509
- let skip = drive. peek_code ( 1 ) as usize ;
510
- if drive. at_end ( ) || !charset_loc_ignore ( & drive. pattern ( ) [ 2 ..] , drive. peek_char ( ) ) {
511
- drive. ctx_mut ( ) . has_matched = Some ( false ) ;
512
- } else {
513
- drive. skip_code ( skip + 1 ) ;
514
- drive. skip_char ( 1 ) ;
515
- }
509
+ general_op_in ( drive, |set, c| charset_loc_ignore ( set, c) ) ;
516
510
} ) ,
517
511
SreOpcode :: INFO | SreOpcode :: JUMP => once ( |drive| {
518
512
drive. skip_code ( drive. peek_code ( 1 ) as usize + 1 ) ;
@@ -661,9 +655,9 @@ fn general_op_literal<F: FnOnce(u32, char) -> bool>(drive: &mut StackDrive, f: F
661
655
}
662
656
}
663
657
664
- fn general_op_in < F : FnOnce ( char ) -> char > ( drive : & mut StackDrive , f : F ) {
658
+ fn general_op_in < F : FnOnce ( & [ u32 ] , char ) -> bool > ( drive : & mut StackDrive , f : F ) {
665
659
let skip = drive. peek_code ( 1 ) as usize ;
666
- if drive. at_end ( ) || !charset ( & drive. pattern ( ) [ 2 ..] , f ( drive. peek_char ( ) ) ) {
660
+ if drive. at_end ( ) || !f ( & drive. pattern ( ) [ 2 ..] , drive. peek_char ( ) ) {
667
661
drive. ctx_mut ( ) . has_matched = Some ( false ) ;
668
662
} else {
669
663
drive. skip_code ( skip + 1 ) ;
@@ -749,18 +743,20 @@ fn charset(set: &[u32], c: char) -> bool {
749
743
}
750
744
SreOpcode :: BIGCHARSET => {
751
745
/* <BIGCHARSET> <blockcount> <256 blockindices> <blocks> */
752
- let count = set[ i + 1 ] ;
746
+ let count = set[ i + 1 ] as usize ;
753
747
if ch < 0x10000 {
754
- let ( _, blockindices, _) = unsafe { set[ i + 2 ..] . align_to :: < u8 > ( ) } ;
755
- let block = blockindices[ ( ch >> 8 ) as usize ] ;
756
- if set[ 2 + 64 + ( ( block as u32 * 256 + ( ch & 255 ) ) / 32 ) as usize ]
757
- & ( 1 << ( ch & ( 32 - 1 ) ) )
748
+ let set = & set[ 2 ..] ;
749
+ let block_index = ch >> 8 ;
750
+ let ( _, blockindices, _) = unsafe { set. align_to :: < u8 > ( ) } ;
751
+ let blocks = & set[ 64 ..] ;
752
+ let block = blockindices[ block_index as usize ] ;
753
+ if blocks[ ( ( block as u32 * 256 + ( ch & 255 ) ) / 32 ) as usize ] & ( 1u32 << ( ch & 31 ) )
758
754
!= 0
759
755
{
760
756
return ok;
761
757
}
762
758
}
763
- i += 2 + 64 + count as usize * 8 ;
759
+ i += 2 + 64 + count * 8 ;
764
760
}
765
761
SreOpcode :: LITERAL => {
766
762
/* <LITERAL> <code> */
0 commit comments