File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 66
77// CHECK-LABEL: @u32_index
88#[ no_mangle]
9- pub fn u32_index ( c : u32 ) -> [ bool ; 10 ] {
10- let mut array = [ false ; 10 ] ;
9+ pub fn u32_index ( c : u32 ) -> [ bool ; 21 ] {
10+ let mut array = [ false ; 21 ] ;
1111
12- let index = ( c | 1 ) . leading_zeros ( ) as usize / 4 - 2 ;
12+ let index = c . ilog2 ( ) ;
1313
1414 // CHECK: call core::panicking::panic
1515 array[ index as usize ] = true ;
@@ -19,12 +19,14 @@ pub fn u32_index(c: u32) -> [bool; 10] {
1919
2020// CHECK-LABEL: @char_as_u32_index
2121#[ no_mangle]
22- pub fn char_as_u32_index ( c : char ) -> [ bool ; 10 ] {
22+ pub fn char_as_u32_index ( c : char ) -> [ bool ; 21 ] {
23+ // CHECK: %[[B:.+]] = icmp ult i32 %c, 1114112
24+ // CHECK: call void @llvm.assume(i1 %[[B]])
2325 let c = c as u32 ;
2426
25- let mut array = [ false ; 10 ] ;
27+ let mut array = [ false ; 21 ] ;
2628
27- let index = ( c | 1 ) . leading_zeros ( ) as usize / 4 - 2 ;
29+ let index = c . ilog2 ( ) ;
2830
2931 // CHECK-NOT: call core::panicking::panic
3032 array[ index as usize ] = true ;
You can’t perform that action at this time.
0 commit comments