Skip to content
Snippets Groups Projects
Commit 51fd6327 authored by Mark Olesen's avatar Mark Olesen
Browse files

use PackedBoolList typedef instead of PackedList<1>

Note:

PackedList constructor initializes to zero, faster not to do it
ourselves.
ie,
    PackedList foo(nPoints);
vs.
    PackedList foo(nPoints, 0);

saves an extra nPoints operations with shifts/masks etc.

If speed is important, change this type of code

    PackedList isMaster(nPoints, 1u);
    for (loop)
    {
        if (condition)
        {
            isMaster.set(i, 0u);   // unset bit
        }
    }
    return isMaster;

into this:

    PackedList notMaster(nPoints);
    for (loop)
    {
        if (!condition)
        {
            notMaster.set(i, 1u);
        }
    }
    notMaster.flip();
    return notMaster;

or this:

    PackedList isMaster(nPoints);
    isMaster.flip();

    for (loop)
    {
        if (condition)
        {
            isMaster.set(i, 0u);
        }
    }
    return isMaster;
parent 99b293ff
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment