Example #1
0
        private void EncodeBinarySubCode(double absValue, byte[] buffer)
        {
            uint pieces = (uint)Math.Min(Math.Floor(absValue / _precisionPiece), (double)_maxPrecisionBitMask);

            for (int bitIdx = _spikeCodeCfg.ComponentHalfCodeLength - 1, i = 0; bitIdx >= 0; bitIdx--, i++)
            {
                buffer[i] = (byte)Bitwise.GetBit(pieces, bitIdx);
            }
            return;
        }