142 {
143 constexpr T mask16 = T(0x0000ffff0000ffff),
144 mask8 = T(0x00ff00ff00ff00ff) ,
145 mask4 = T(0x0f0f0f0f0f0f0f0f) , mask2 = T(0x3333333333333333) ,
146 mask1 = T(0x5555555555555555) ;
147 T ret1 = x & mask1, ret2 = (x >> 1) & mask1;
148 ret1 = (ret1 ^ (ret1 >> 1)) & mask2;
149 ret2 = (ret2 ^ (ret2 >> 1)) & mask2;
150 ret1 = (ret1 ^ (ret1 >> 2)) & mask4;
151 ret2 = (ret2 ^ (ret2 >> 2)) & mask4;
152 if(sizeof(T) >= 2)
153 {
154 ret1 = (ret1 ^ (ret1 >> 4)) & mask8;
155 ret2 = (ret2 ^ (ret2 >> 4)) & mask8;
156 }
157 if(sizeof(T) >= 4)
158 {
159 ret1 = (ret1 ^ (ret1 >> 8)) & mask16;
160 ret2 = (ret2 ^ (ret2 >> 8)) & mask16;
161 }
162 if(sizeof(T) >= 8)
163 {
164 ret1 = (ret1 ^ (ret1 >> 16)) ;
165 ret2 = (ret2 ^ (ret2 >> 16)) ;
166 }
167 return bit_deinterleave_result<R>{R(ret1), R(ret2)};
168 }