Expand every bit into a byte
Use a multiplication to perform several shifts in a single instruction.


Trim the input to seven bits to avoid overlap in the second step.
Shift by 0, 7, 14, 21, 28, 35, 42 bits and aggregate the results in a 64-bit integer.
Keep only bits 0, 8, 16, 24, 32, 40, 48.
Handle the 8th bit of the input separately. Shift by 49, then add it to the others.


Example code in C#

ulong Expand(byte b)
{
    ulong shift = 0x0000040810204081ul; // bits set: 0, 7, 14, 21, 28, 35, 42
    ulong mask = 0x0001010101010101ul; // bits set: 0, 8, 16, 24, 32, 40, 48
    return (ulong)(b &amp; 127) * shift &amp; mask | (ulong)(b &amp; 128) &lt;&lt; 49;
}