int [] resolve(int [] cl1, int [] cl2) { IntVector result = new IntVector(4); int [] combined = new int [cl1.Length + cl2.Length]; Array.Copy(cl1, 0, combined, 0, cl1.Length); Array.Copy(cl2, 0, combined, cl1.Length, cl2.Length); Array.Sort(combined); for (int i = 0; i < combined.Length; ++i) { if (result.empty()) { result.push_back(combined[i]); } else if (result.back == combined[i]) { continue; } else if (result.back == (combined[i] ^ 1)) { result.pop_back(); } else { result.push_back(combined[i]); } } return(result.ToArray()); }
public void set_resolvent(int uid) { if (enable) { ResolveNode nd = new ResolveNode(uid, reasons.ToArray()); if (storage is MemoryStream && storage.Length + nd.footprint() > cache_limit) //out of cache, so use file { Stream newstream = new FileStream(filename, FileMode.Create); MemoryStream memstream = storage as MemoryStream; byte [] buffer = memstream.ToArray(); newstream.Write(buffer, 0, buffer.Length); storage = newstream; } nd.Serialize(storage); } reasons.clear(); }