public UnevenByte ToUnevenByte(EncodedLZByte eb) { if (eb is PointerByte pb) { var data = (1 << PointerByte.POINTER_SIZE) + pb.Pointer; data = (data << PointerByte.LENGTH_SIZE) + pb.Length; return(new UnevenByte((uint)data, PointerByte.POINTER_SIZE + PointerByte.LENGTH_SIZE + 1)); } return(new UnevenByte(((RawByte)eb).Data, RawByte.RAW_SIZE + 1)); }
public void DecodeAndAddEncodedByte(EncodedLZByte eb) { if (eb is PointerByte pb) { // If it is a pointer byte, add the bytes, that it points to, to the output var bi = Count - pb.Pointer; for (var ai = 0; ai < pb.Length; ++ai) { Add(this[bi + ai]); } } else { // If it is a raw byte, add the raw bytes to the output Add(((RawByte)eb).Data); } }