public void IsSameEndiannessAsGetBytes() { var packed = new Packed(new [] { 1, 1L << 63 }); var bytes = packed.GetBytes().ToList(); Assert.AreEqual(1, bytes[0]); Assert.AreEqual(0x80, bytes[15]); }
public void CanGetBackPackedBytes() { var packed = new Packed(new long[] { 1, 2, 3 }); var bytes = packed.GetBytes(); Assert.IsTrue(bytes.SequenceEqual(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0 })); }
/// <summary> /// Retrieves the coefficients from this <see cref="Slice"/>. /// </summary> public IEnumerable <bool> GetCoefficients() => _packedCoefficients .GetBytes() .ToBits() .Take(_numCoefficients);