Optimization problem: bulk Boolean operations on vectors

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Dec 23 14:33:31 PST 2016


On 12/23/2016 05:11 PM, Walter Bright wrote:
> void foo(int* a, int* b) {
>     int* atop = a + 1000;
>     ptrdiff_t offset = b - a;
>     for (; a < atop; ++a)
>     *a &= *(a + offset);
> }

That's a neat trick, thanks hardreset (and Walter for making it 
high-level). There are a bunch of places in druntime and phobos that 
could use it. -- Andrei


More information about the Digitalmars-d mailing list