File tree Expand file tree Collapse file tree 2 files changed +2
-15
lines changed
Expand file tree Collapse file tree 2 files changed +2
-15
lines changed Original file line number Diff line number Diff line change 2222#![ feature( derive_coerce_pointee) ]
2323#![ feature( arbitrary_self_types) ]
2424#![ feature( macro_metavar_expr) ]
25+ #![ feature( uint_carryless_mul) ]
2526// Configure clippy and other lints
2627#![ allow(
2728 clippy:: collapsible_else_if,
Original file line number Diff line number Diff line change @@ -1178,21 +1178,7 @@ fn pclmulqdq<'tcx>(
11781178 let index = if ( imm8 & 0x10 ) == 0 { lo } else { hi } ;
11791179 let right = ecx. read_scalar ( & ecx. project_index ( & right, index) ?) ?. to_u64 ( ) ?;
11801180
1181- // Perform carry-less multiplication.
1182- //
1183- // This operation is like long multiplication, but ignores all carries.
1184- // That idea corresponds to the xor operator, which is used in the implementation.
1185- //
1186- // Wikipedia has an example https://en.wikipedia.org/wiki/Carry-less_product#Example
1187- let mut result: u128 = 0 ;
1188-
1189- for i in 0 ..64 {
1190- // if the i-th bit in right is set
1191- if ( right & ( 1 << i) ) != 0 {
1192- // xor result with `left` shifted to the left by i positions
1193- result ^= u128:: from ( left) << i;
1194- }
1195- }
1181+ let result = left. widening_carryless_mul ( right) ;
11961182
11971183 let dest = ecx. project_index ( & dest, i) ?;
11981184 ecx. write_scalar ( Scalar :: from_u128 ( result) , & dest) ?;
You can’t perform that action at this time.
0 commit comments