Cosmos/source2/Users/Orvid/Orvid.Graphics.Cosmos/GraphicsPlugs.cs
blah38621_cp 92dcac4a51 Made a few improvements to the speed of the ILScanner, including caching the resolved plugs.
Added the possibility for an optimization step in the IL2CPU MSBuild task. Currently commented out, but should work fine with a few modifications to the optimizer.
Moved classes that are dependent on Cosmos from the Orvid.Graphics, into the Orvid.Graphics.Cosmos assembly. 
Re-factored the font mechanism, added partially working .fnt Font support. 
Added a Rectangle class, and a Vec2d class, which is the same as Vec2, except with doubles for the X and Y values.
Made a small aesthetic improvement to the output of the File2ByteArray Converter.
2011-09-03 21:05:46 +00:00

46 lines
1.9 KiB
C#

using System;
using System.Text;
using Cosmos.IL2CPU.Plugs;
using CPUAll = Cosmos.Compiler.Assembler;
using CPUx86 = Cosmos.Compiler.Assembler.X86;
namespace Orvid.Graphics
{
[Plug(Target = typeof(global::System.Math))]
class MathImpl
{
//[Inline]
public static double Sin(double m)
{
return 0;
//new CPUx86.x87.FloatLoad { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true, DestinationDisplacement = 8 };
//new CPUx86.x87.FloatSine { };
//// reservate 8 byte for returntype double on stack
//new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceValue = 8 };
//// write double value to this reservation
//new CPUx86.x87.FloatStoreAndPop { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true };
//// after this is the result popped
//return 0.0;
}
//[Inline]
public static double Cos(double x)
{
return 0;
//new CPUx86.x87.FloatLoad { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true, DestinationDisplacement = 8 };
//new CPUx86.x87.FloatCosine { };
//// reservate 8 byte for returntype double on stack
//new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceValue = 8 };
//// write double value to this reservation
//new CPUx86.x87.FloatStoreAndPop { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true };
//// after this is the result popped
//return 0.0;
}
public static double Floor(double d)
{
String str = d.ToString();
return (double)Int32.Parse(str.Substring(0, str.IndexOf('.')));
}
}
}