uint64 pack(uint64 dat, uint64 mask, uint64 HighBit, uint64 LowBit)

Top  Previous  Next

This does the data extraction, bit packing and shifting needed to normalize a given signal's data.  You pass the signal's data mask (returned from the channelselect configuration option) and the current raw data sample.  It returns the signal's bits, packed together and 0-bit justified.  The remaining parameters are the highest and lowest set bits in the data mask.  These should be pre-calculated from the data mask, ONCE during initialization.  Since pack is called hundreds of thousands of times pre signal per capture, performance is improved by pre-calculating these limits and then having the pack routine limit its work to this range.