summaryrefslogtreecommitdiff
path: root/AK/BitStream.h
AgeCommit message (Collapse)Author
2021-06-25AK: Add big endian bit reading to InputBitStreamkleines Filmröllchen
The existing InputBitStream methods only read in little endian, as this is what the rest of the system requires. Two new methods allow the input bitstream to read bits in big endian as well, while using the existing state infrastructure. Note that it can lead to issues if little endian and big endian reads are used out of order without aligning to a byte boundary first.
2021-04-22AK+Userland: Use idan.horowitz@serenityos.org for my copyright headersIdan Horowitz
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-16LibCompress+AK: Dont short-circuit error handling propagationIdan Horowitz
In the case that both the stream and the wrapped substream had errors to be handled only one of the two would be resolved due to boolean short circuiting. this commit ensures both are handled irregardless of one another.
2021-03-15LibCompress+AK: Propagate error handling to wrapped streamsIdan Horowitz
This ensures that when a DeflateCompressor stream is cleared of any errors its underlying wrapped streams (InputBitStream/InputMemoryStream) will be cleared as well and wont fail a VERIFY on destruction.
2021-03-13AK: Add fast paths for aligned bit writes in BitOutputStreamIdan Horowitz
If the bit write is aligned (or has been aligned during the write) we can write in multiples of 32/16/8 bits for increased performance.
2021-03-13AK: Add OutputBitStream classIdan Horowitz
This will be used in the deflate compressor.
2020-09-14AK: Lower the requirements for InputStream::eof and rename it.asynts
Consider the following snippet: void foo(InputStream& stream) { if(!stream.eof()) { u8 byte; stream >> byte; } } There is a very subtle bug in this snippet, for some input streams eof() might return false even if no more data can be read. In this case an error flag would be set on the stream. Until now I've always ensured that this is not the case, but this made the implementation of eof() unnecessarily complicated. InputFileStream::eof had to keep a ByteBuffer around just to make this possible. That meant a ton of unnecessary copies just to get a reliable eof(). In most cases it isn't actually necessary to have a reliable eof() implementation. In most other cases a reliable eof() is avaliable anyways because in some cases like InputMemoryStream it is very easy to implement.
2020-09-12AK: Fix accidentally-recursive call in BitStreamBen Wiederhake
2020-09-06Streams: Consistent behaviour when reading from stream with error.asynts
The streaming operator doesn't short-circuit, consider the following snippet: void foo(InputStream& stream) { int a, b; stream >> a >> b; } If the first read fails, the second is called regardless. It should be well defined what happens in this case: nothing.
2020-09-01Streams: Distinguish recoverable and fatal errors.asynts
2020-08-26AK: Add InputBitStream class.asynts