 }
 
 __global__
+void init_64( int i )
+{
+    for( int i=0; i<64; i++ ) index_array_64[i] = i;
+
+    if( i == 0 )
+        for( int i=0; i<64; i++ ) array_64[i] = 647 * i % 97;
+    else if( i == 1 )
+        for( int i=0; i<64; i++ ) array_64[i] = 64 - i;
+    else
+        for( int i=0; i<64; i++ ) array_64[i] = i;
+}
+
+__global__
 void print_32( )
 {
     for( int i=0; i<32; i++ ) {
         printf( "%d ", array_32[index_array_32[i]] );
+    }
+    printf("\n");
+}
+
+__global__
+void print_64( )
+{
+    for( int i=0; i<64; i++ ) {
+        printf( "%d ", array_64[index_array_64[i]] );
     }
     printf("\n");
 }


__device__ int array_32[32];
__device__ int index_array_32[32];

__global__
void sort_32( )

    }

    __device__ inline
    void swap( int& l, int& r )
    {
        int m = r;
        r = l;
        l = m;
    }

    __device__ inline
    int sort32( int my_index )
    {
        for( int outer=0; outer<5; outer++ ) {
            for( int inner=outer; inner>=0; inner-- ) {
                my_index = shiftit( my_index, inner, outer+1, false );
            }
        }
        return my_index;
    }

    __device__ inline
    void sort64( int2& my_indeces )
    {
        for( int outer=0; outer<5; outer++ ) {
            for( int inner=outer; inner>=0; inner-- ) {
                my_indeces.x = shiftit( my_indeces.x, inner, outer+1, false );
                my_indeces.y = shiftit( my_indeces.y, inner, outer+1, true );
            }
        }

        if( _array[my_indeces.x] < _array[my_indeces.y] ) swap( my_indeces.x, my_indeces.y );

        for( int outer=0; outer<5; outer++ ) {
            for( int inner=outer; inner>=0; inner-- ) {
                my_indeces.x = shiftit( my_indeces.x, inner, outer+1, false );
                my_indeces.y = shiftit( my_indeces.y, inner, outer+1, false );
            }
        }
    }

private:
    __device__ inline
    int shiftit( const int my_index, const int shift, const int direction, const bool increasing )
    {
        const T    my_val      = _array[my_index];
        const T    other_val   = __shfl_xor( my_val, 1 << shift );
        const bool my_less     = ( my_val < other_val );
        const bool reverse     = ( threadIdx.x & ( 1 << direction ) );
        const bool id_less     = ( ( threadIdx.x & ( 1 << shift ) ) == 0 );
        const bool must_swap   = not ( my_less ^ id_less ^ reverse ^ increasing );

        return ( must_swap ? __shfl_xor( my_index, 1 << shift )
                           : my_index );
