Casting a vector operation
bearophile
bearophileHUGS at lycos.com
Wed Apr 27 16:03:14 PDT 2011
Andrej Mitrovic:
> So here's how a float>int conversion looks like:
>
> http://codepad.org/bqINREKG
Just a cast(int) for each item array is probably enough.
>Is there any way to use a vector op that operates on floats but stores each result as an int?
Not yet, as far as I know. But the feature you look for may be implemented later. Don wants to vectorize even sin, cos, etc functions.
> Should I be worried that these are typed as void*? I mean I've read something about a GC problem where the GC could interpret the value stored in a void* as a pointer to random data in the heap, which could lead to memory leaks, or something of that sort.
If you use a type that can't contain pointers, like a ubyte[] the situation probably improves (no outbound pointers are followed) but inbound pointers are followed still by the GC, and they cause troubles when arrays are large (the array is never deallocated).
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list