コード例 #1
0
        public static StringBuilder PrintMask(this FastBitMask128 ba, int greenbit = -1, bool[] redbits = null)
        {
            str.Length = 0;
            str._("[");
            for (int i = ba.BitCount - 1; i >= 0; --i)
            {
                if (i == greenbit)
                {
                    str._GrnB_(ba[i] ? 1 : 0);
                }
                else if (redbits != null && i < redbits.Length && redbits[i])
                {
                    str._RedB_(ba[i] ? 1 : 0);
                }
                else
                {
                    str._(ba[i] ? "1" : "<color=#0f0f0f>0</color>");
                }

                if (i % 32 == 0)
                {
                    str._((i == 0) ? "]" : "] [");
                }
                else if (i % 8 == 0 && i != 0)
                {
                    str._(":");
                }
            }

            return(str);
        }
コード例 #2
0
        public static StringBuilder PrintMask(this FastBitMask128 ba, StringBuilder[] colorbits = null)
        {
            str.Length = 0;
            str._("[");
            for (int i = ba.BitCount - 1; i >= 0; --i)
            {
                if (colorbits != null && i < colorbits.Length && colorbits[i] != null && colorbits[i].ToString() != "")
                {
                    str._("<b><color=" + colorbits[i].ToString() + ">" + (ba[i] ? 1 : 0) + "</color></b>");
                }
                else
                {
                    str._(ba[i] ? "1" : "<color=#0f0f0f>0</color>");
                }

                if (i % 32 == 0)
                {
                    str._((i == 0) ? "]" : "] [");
                }
                else if (i % 8 == 0 && i != 0)
                {
                    str._(":");
                }
            }

            return(str);
        }
コード例 #3
0
        public void OR(FastBitMask128 other, int otherOffset)
        {
            if (otherOffset == 0)
            {
                seg1 |= other.seg1;
                seg2 |= other.seg2;
                return;
            }
            if (otherOffset == 64)
            {
                seg2 |= other.seg1;
                return;
            }
            if (otherOffset >= 128)
            {
                return;
            }
            if (otherOffset > 64)
            {
                seg2 |= (seg1 << (otherOffset - 64));
                return;
            }

            seg1 |= other.seg1 << otherOffset;
            seg2 |= other.seg1 >> (64 - otherOffset);
            seg2 |= other.seg2 << otherOffset;
        }
コード例 #4
0
 public bool Compare(FastBitMask128 other)
 {
     return
         (bitcount == other.bitcount &&
          seg1 == other.seg1 &&
          seg2 == other.seg2);
 }
コード例 #5
0
 public void Copy(FastBitMask128 other)
 {
     bitcount     = other.bitcount;
     seg1bitcount = other.seg1bitcount;
     seg2bitcount = other.seg2bitcount;
     seg1         = other.seg1;
     seg2         = other.seg2;
     alltrue1     = other.alltrue1;
     alltrue2     = other.alltrue2;
 }
コード例 #6
0
 public FastBitMask128(FastBitMask128 copyFrom)
 {
     this.seg1         = copyFrom.seg1;
     this.seg2         = copyFrom.seg2;
     this.bitcount     = copyFrom.bitcount;
     this.seg1bitcount = copyFrom.seg1bitcount;
     this.seg2bitcount = copyFrom.seg2bitcount;
     this.alltrue1     = copyFrom.alltrue1;
     this.alltrue2     = copyFrom.alltrue2;
 }
コード例 #7
0
 public void XOR(FastBitMask128 other)
 {
     seg1 ^= other.seg1;
     seg2 ^= other.seg2;
 }
コード例 #8
0
 public void AND(FastBitMask128 other)
 {
     seg1 &= other.seg1;
     seg2 &= other.seg2;
 }
コード例 #9
0
 public void OR(FastBitMask128 other)
 {
     seg1 |= other.seg1;
     seg2 |= other.seg2;
 }