Exemple #1
0
        /// <summary>
        /// Create a new ZenBitwiseNot expr.
        /// </summary>
        /// <param name="expr"></param>
        /// <returns></returns>
        public static Zen <T> Create(Zen <T> expr)
        {
            CommonUtilities.ValidateNotNull(expr);
            CommonUtilities.ValidateIsIntegerType(typeof(T));

            hashConsTable.GetOrAdd(expr.Id, () => Simplify(expr), out var value);
            return(value);
        }
Exemple #2
0
        public static Zen <T> Create(Zen <T> expr)
        {
            CommonUtilities.ValidateNotNull(expr);
            CommonUtilities.ValidateIsIntegerType(typeof(T));

            if (hashConsTable.TryGetValue(expr, out var value))
            {
                return(value);
            }

            var ret = Simplify(expr);

            hashConsTable[expr] = ret;
            return(ret);
        }