コード例 #1
0
ファイル: ASMFormatHelper.cs プロジェクト: xjamxx/FFTPatcher
        private uint[] FindBaseValues(string expFormat)
        {
            char[] chars        = expFormat.ToCharArray();
            char[] bitMaskChars = new char[chars.Length];

            for (int i = 0; i < chars.Length; i++)
            {
                if (!char.IsDigit(chars[i]))
                {
                    chars[i]        = '0';
                    bitMaskChars[i] = '0';
                }
                else
                {
                    bitMaskChars[i] = '1';
                }
            }

            string strBaseEncoding = new string(chars);
            string strBitMask      = new string(bitMaskChars);

            uint baseEncoding = ASMValueHelper.BinaryToUnsigned(strBaseEncoding);
            uint bitMask      = ASMValueHelper.BinaryToUnsigned(strBitMask);
            uint opcode       = baseEncoding >> 26;
            uint function     = baseEncoding & 0x3F;

            uint[] result = new uint[4];
            result[0] = baseEncoding;
            result[1] = bitMask;
            result[2] = opcode;
            result[3] = function;

            return(result);
        }