Ejemplo n.º 1
0
        static PlatformConfig()
        {
            Configuration.Add("x86 standard", new Platform
            {
                Description     = "x86 Standard (32-bit, little endian, double)",
                BigEndian       = false,       // 1 = little endian
                IntegerSize     = 4,           // (data type sizes in bytes)
                SizeT           = 4,
                InstructionSize = 4,
                NumberSize      = 8,           // this & integral identifies the
                IsFloatingPoint = true,        // (0) type of lua_Number
                NumberType      = "double",    // used for lookups
            });
            Configuration.Add("big endian int", new Platform
            {
                Description     = "(32-bit, big endian, int)",
                BigEndian       = true,
                IntegerSize     = 4,
                SizeT           = 4,
                InstructionSize = 4,
                NumberSize      = 4,
                IsFloatingPoint = false,
                NumberType      = "int",
            });
            Configuration.Add("amd64", new Platform
            {
                Description     = "AMD64 (64-bit, little endian, double)",
                BigEndian       = false,
                IntegerSize     = 4,
                SizeT           = 8,
                InstructionSize = 4,
                NumberSize      = 8,
                IsFloatingPoint = true,
                NumberType      = "double",
            });
            // you can add more platforms here

            LuaNumberID.Add("80", "double");         // IEEE754 double
            LuaNumberID.Add("40", "single");         // IEEE754 single
            LuaNumberID.Add("41", "int");            // int
            LuaNumberID.Add("81", "long long");      // long long

            ConvertFrom.Add("double", fromDouble);
            ConvertFrom.Add("single", fromSingle);
            ConvertFrom.Add("int", fromInt);
            ConvertFrom.Add("long long", fromInt);

            ConvertTo.Add("double", toDouble);
            ConvertTo.Add("int", toInt);
            ConvertTo.Add("single", toSingle);
            ConvertTo.Add("long long", toInt);
        }