コード例 #1
0
        public static Int128 operator &(Int128 a, Int128 b)
        {
            Int128 c;

            UInt128.And(out c.v, ref a.v, ref b.v);
            return(c);
        }
コード例 #2
0
ファイル: BoardState.cs プロジェクト: danzel/PatchworkSim
        public bool CanPlace(PieceBitmap bitmap, int x, int y)
        {
#if SAFE_MODE || DEBUG
            if (x < 0)
            {
                throw new Exception("X is outside of range");
            }
            if (y < 0)
            {
                throw new Exception("Y is outside of range");
            }

            if (x + bitmap.Width > Width)
            {
                throw new Exception("X is outside of range");
            }
            if (y + bitmap.Height > Height)
            {
                throw new Exception("Y is outside of range");
            }
#endif

            //var shifted = bitmap.Bitmap << (x + y * Width);
            var shifted = bitmap.GetShifted(x, y);

            //return (shifted & _state).IsZero;
            UInt128.And(out shifted, ref shifted, ref _state);
            return(shifted.IsZero);
        }