Пример #1
0
/* Update board state after setting a digit (clearing not handled)
 */
static
void
update( int idx )
{
    const int row = ROW( idx );
    const int col = COLUMN( idx );
    const int block = IDX_BLOCK( row, col );
    const int mask = DIGIT_STATE( DIGIT( idx ) );
    int i;

    board[ idx ] |= STATE_MASK;  /* filled - no choice possible */

    /* Digit cannot appear in row, column or block */
    for( i = 0 ; i < 9 ; ++i )
    {
        board[ idx_row( row, i ) ] |= mask;
        board[ idx_column( col, i ) ] |= mask;
        board[ idx_block( block, i ) ] |= mask;
    }
}
Пример #2
0
 template <typename Ptr2D> __device__ __forceinline__ D at(typename Ptr2D::index_type y, typename Ptr2D::index_type x, const Ptr2D& src) const
 {
     return saturate_cast<D>(src(idx_row(y), idx_col(x)));
 }
Пример #3
0
 template <typename T> __device__ __forceinline__ D at(int y, int x, const T* data, size_t step) const
 {
     return saturate_cast<D>(((const T*)((const char*)data + idx_row(y) * step))[idx_col(x)]);
 }
Пример #4
0
 __device__ __forceinline__ typename PtrTraits<SrcPtr>::value_type operator ()(int y, int x) const
 {
     return src(idx_row(y), idx_col(x));
 }