示例#1
0
        public override object Subtract(object output, object inc)
        {
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(Valid(output, false));
                Debugging.Assert(Valid(inc, false));
            }
            Int64 output2 = (Int64)output;
            Int64 inc2    = (Int64)inc;

            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(output2 >= inc2);
            }

            if (inc2 == NO_OUTPUT)
            {
                return(output2);
            }
            else if (output2.Equals(inc2))
            {
                return(NO_OUTPUT);
            }
            else
            {
                return(Int64.GetInstance(output2 - inc2));
            }
        }
示例#2
0
        public override object Common(object output1, object output2)
        {
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(Valid(output1, false));
                Debugging.Assert(Valid(output2, false));
            }
            Int64 output1_ = (Int64)output1;
            Int64 output2_ = (Int64)output2;

            if (output1_ == NO_OUTPUT || output2_ == NO_OUTPUT)
            {
                return(NO_OUTPUT);
            }
            else if (doShare)
            {
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(output1_ > 0);
                    Debugging.Assert(output2_ > 0);
                }
                return(Int64.GetInstance(Math.Min(output1_, output2_)));
            }
            else if (output1_.Equals(output2_))
            {
                return(output1_);
            }
            else
            {
                return(NO_OUTPUT);
            }
        }