diff options
Diffstat (limited to 'libqpdf/BitWriter.cc')
-rw-r--r-- | libqpdf/BitWriter.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libqpdf/BitWriter.cc b/libqpdf/BitWriter.cc index 4fb375cb..7513ac76 100644 --- a/libqpdf/BitWriter.cc +++ b/libqpdf/BitWriter.cc @@ -18,6 +18,21 @@ BitWriter::writeBits(unsigned long long val, unsigned int bits) } void +BitWriter::writeBitsSigned(long long val, unsigned int bits) +{ + unsigned long long uval = 0; + if (val < 0) + { + uval = static_cast<unsigned long long>((1 << bits) + val); + } + else + { + uval = static_cast<unsigned long long>(val); + } + writeBits(uval, bits); +} + +void BitWriter::flush() { if (bit_offset < 7) |