public NetBigInteger And( NetBigInteger value) { if (m_sign == 0 || value.m_sign == 0) { return Zero; } int[] aMag = m_sign > 0 ? m_magnitude : Add(One).m_magnitude; int[] bMag = value.m_sign > 0 ? value.m_magnitude : value.Add(One).m_magnitude; bool resultNeg = m_sign < 0 && value.m_sign < 0; int resultLength = System.Math.Max(aMag.Length, bMag.Length); int[] resultMag = new int[resultLength]; int aStart = resultMag.Length - aMag.Length; int bStart = resultMag.Length - bMag.Length; for (int i = 0; i < resultMag.Length; ++i) { int aWord = i >= aStart ? aMag[i - aStart] : 0; int bWord = i >= bStart ? bMag[i - bStart] : 0; if (m_sign < 0) { aWord = ~aWord; } if (value.m_sign < 0) { bWord = ~bWord; } resultMag[i] = aWord & bWord; if (resultNeg) { resultMag[i] = ~resultMag[i]; } } NetBigInteger result = new NetBigInteger(1, resultMag, true); if (resultNeg) { result = result.Not(); } return result; }