Esempio n. 1
0
        //
        // Is右向即Is大端序
        private static BigInteger 初始化(String 源数_输入, Boolean Is右向_输入 = default, 进制 进制_输入 = 进制.十进制, 分隔符 分隔符_输入 = 分隔符.空格, 符号 符号_输入 = 符号.默认, Boolean Is补码_输入 = default)
        {
            // 异常情况处理
            // 空串、空引用处理
            if (IsNullOrEmpty(源数_输入))
            {
                throw new NullReferenceException();
            }
            else
            {
                // 占位
            }

            Boolean Is含符号 = default;
            Boolean?正号_处理 = default;
            Boolean Is未定义 = default;
            String  首字符   = 源数_输入[default].ToString();
Esempio n. 2
0
        private static BigInteger 初始化(UInt64[] 源数_输入, Boolean Is右向_输入 = default, 符号 符号_输入 = 符号.默认, Boolean Is补码_输入 = true)
        {
            // 异常情况
            if (IsNullOrEmpty(源数_输入))
            {
                throw new ArgumentNullException();
            }
            else
            {
                // 占位
            }

            // 预处理
            if (Is右向_输入)
            {
                Array.Reverse(源数_输入);
            }
            else
            {
                // 占位
            }


            Boolean?正号_处理 = Is补码_输入 ? default : 转换符号(符号_输入);
                            Boolean Is负数 = default;

                            if (Is补码_输入 == true)
                            {
                                Is负数 = 获取符号(源数_输入);          // 也可以使用移位的版本:(源数_输入[^ToInt32(一索引化(default))] >> 向前(四字位数)) != default

                                if (Is负数)                    // 负数
                                {
                                    源数_输入 = 求2的补码_核心(源数_输入); // 是负数,执行操作

                                    正号_处理 = false;
                                }
                                else                    // 正数、〇
                                {
                                    if (Is0_纯粹版(源数_输入)) // 〇的情况
                                    {
                                        // 占位
                                    }
                                    else                // 正数的情况
                                    {
                                        正号_处理 = true;
                                    }
                                }
                            }
                            else                // 正数、〇、原码的负数
                            {
                                if (Is0(源数_输入)) // 〇的情况
                                {
                                    if (正号_处理 != default)
                                    {
                                        正号_处理 = default;                        // 即以数值为准
                                    }
                                    else
                                    {
                                        // 占位
                                    }
                                }
                                else            // 非〇的情况
                                {
                                    if (正号_处理 == default)
                                    {
                                        throw new Exception("Pattern Error");
                                    }
                                    else
                                    {
                                        // 占位
                                    }
                                }
                            }

                            return(初始化_核心(正号_处理, 源数_输入));
        }
Esempio n. 3
0
 //
 private static BigInteger 初始化(Char[] 源数_输入, Boolean Is右向_输入 = default, 进制 进制_输入 = 进制.十进制, 分隔符 分隔符_输入 = 分隔符.空格, 符号 符号_输入 = 符号.默认, Boolean Is补码_输入 = default) => 初始化(new String(源数_输入), Is右向_输入, 进制_输入, 分隔符_输入, 符号_输入, Is补码_输入);
Esempio n. 4
0
 // 兼有:8(SByte、Byte)、16(Int16、UInt16、部分Char)、32(Int32、UInt32)、64(Int64、UInt64)位的数组
 unsafe private static BigInteger 初始化 <T>(T[] 源数_输入, Boolean Is右向_输入 = default, 符号 符号_输入 = 符号.默认, Boolean Is补码_输入 = true) where T : unmanaged => 初始化(转换数组 <UInt64, T>(源数_输入), Is右向_输入, 符号_输入, Is补码_输入);