primitive vector types
Bill Baxter
wbaxter at gmail.com
Mon Feb 23 12:02:13 PST 2009
On Mon, Feb 23, 2009 at 10:24 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Don wrote:
>>
>> Bill Baxter wrote:
>>>
>>> Actually its 4^4 if you do it like OpenCL/GLSL/HLSL/Cg and allow
>>> repeats like .xxyy.
>>
>> Yes. Is the syntax sugar actually needed for all the permutations?
>> Even so, it's still only 256, which is probably still OK. I don't think a
>> language change is required.
>
> There's no need to ever enumerate all functions - they can be generated with
> templates and mixins rather easily.
I think the issue is just that however you get them there it's a lot
of exe bloat. The ideal would be something like a template that only
got instantiated when used, like vec2 = vec1.swizzle!("xyzy"); ...
but with the syntax vec2 = vec1.xyzy. And which can generate optimal
assembly.
Really, if .swizzle!("xyzy") can do that, though, that looks good
enough to me. I would rather have that than 256 silly little
functions that get instantiated no matter what.
--bb
More information about the Digitalmars-d
mailing list