[Mono-docs-list] Mono.Simd API Suggestions

Jonathan Pryor jonpryor at vt.edu
Wed Nov 5 10:54:19 EST 2008

On Tue, 2008-11-04 at 21:00 -0500, Jonathan Pryor wrote:
> ...

Other suggestions:

SimdRuntime.IsMethodAccelerated() and
SimdRuntime.MethodAccelerationMode() should be overloaded to accept a
MethodInfo of the desired method, as it can be ~trivial to get a
MethodInfo in a static, type-checked fashion, e.g.:

	MethodInfo average = ((Func<Vector8us, Vector8us, Vector8us>)
	bool b = SimdRuntime.IsMethodAccelerated (average);

Even better, this is _faster_ than typeof(Vector8us).GetMethod
("Average").  (Not by a lot, but faster nonetheless.)

AccelerationAttribute should be AcceleratedOnAttribute, and AccelMode
should be InstructionSet.  I think this would make for more readable
documentation prototypes:

	[Mono.Simd.AcceleratedOn (Mono.Simd.InstructionSet.SSE2)]
	public static Vector8us Average (Vector8us va, Vector8us vb);

Finally (for now), parameter names should be more consistent.  On some
methods the arguments are (va, vb) (e.g. Vector8us.Average()), while on
others they're (v1, v2) (e.g. Vector2d.InterleaveHigh()).  I don't care
which we choose, but we should stick to something and use it
consistently (`a` and `b`, perhaps?).

(This will be even more useful in C# 4 in which arguments can be named,
as changing the method invoked won't needlessly require changing the
parameter names...)

 - Jon

More information about the Mono-docs-list mailing list