File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -325,7 +325,11 @@ where
325
325
const INDEX : [ Which ; LANES ] = hi :: < LANES > ( ) ;
326
326
}
327
327
328
- ( Lo :: swizzle2 ( self , other) , Hi :: swizzle2 ( self , other) )
328
+ if LANES == 1 {
329
+ ( self , other)
330
+ } else {
331
+ ( Lo :: swizzle2 ( self , other) , Hi :: swizzle2 ( self , other) )
332
+ }
329
333
}
330
334
331
335
/// Deinterleave two vectors.
@@ -380,6 +384,10 @@ where
380
384
const INDEX : [ Which ; LANES ] = odd :: < LANES > ( ) ;
381
385
}
382
386
383
- ( Even :: swizzle2 ( self , other) , Odd :: swizzle2 ( self , other) )
387
+ if LANES == 1 {
388
+ ( self , other)
389
+ } else {
390
+ ( Even :: swizzle2 ( self , other) , Odd :: swizzle2 ( self , other) )
391
+ }
384
392
}
385
393
}
Original file line number Diff line number Diff line change @@ -60,3 +60,17 @@ fn interleave() {
60
60
assert_eq ! ( even, a) ;
61
61
assert_eq ! ( odd, b) ;
62
62
}
63
+
64
+ // portable-simd#298
65
+ #[ test]
66
+ #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen_test) ]
67
+ fn interleave_one ( ) {
68
+ let a = Simd :: from_array ( [ 0 ] ) ;
69
+ let b = Simd :: from_array ( [ 1 ] ) ;
70
+ let ( lo, hi) = a. interleave ( b) ;
71
+ assert_eq ! ( lo. to_array( ) , [ 0 ] ) ;
72
+ assert_eq ! ( hi. to_array( ) , [ 1 ] ) ;
73
+ let ( even, odd) = lo. deinterleave ( hi) ;
74
+ assert_eq ! ( even, a) ;
75
+ assert_eq ! ( odd, b) ;
76
+ }
You can’t perform that action at this time.
0 commit comments