@@ -270,6 +270,7 @@ public final class LsbBitReader: ByteReader, BitReader {
270270 */
271271 public override func byte( ) -> UInt8 {
272272 precondition ( isAligned, " BitReader is not aligned. " )
273+ defer { self . currentByte = self . ptr [ self . _offset] }
273274 return super. byte ( )
274275 }
275276
@@ -281,6 +282,7 @@ public final class LsbBitReader: ByteReader, BitReader {
281282 */
282283 public override func bytes( count: Int ) -> [ UInt8 ] {
283284 precondition ( isAligned, " BitReader is not aligned. " )
285+ defer { self . currentByte = self . ptr [ self . _offset] }
284286 return super. bytes ( count: count)
285287 }
286288
@@ -293,6 +295,7 @@ public final class LsbBitReader: ByteReader, BitReader {
293295 */
294296 public override func int( fromBytes count: Int ) -> Int {
295297 precondition ( isAligned, " BitReader is not aligned. " )
298+ defer { self . currentByte = self . ptr [ self . _offset] }
296299 return super. int ( fromBytes: count)
297300 }
298301
@@ -304,6 +307,7 @@ public final class LsbBitReader: ByteReader, BitReader {
304307 */
305308 public override func uint64( ) -> UInt64 {
306309 precondition ( isAligned, " BitReader is not aligned. " )
310+ defer { self . currentByte = self . ptr [ self . _offset] }
307311 return super. uint64 ( fromBytes: 8 )
308312 }
309313
@@ -316,6 +320,7 @@ public final class LsbBitReader: ByteReader, BitReader {
316320 */
317321 public override func uint64( fromBytes count: Int ) -> UInt64 {
318322 precondition ( isAligned, " BitReader is not aligned. " )
323+ defer { self . currentByte = self . ptr [ self . _offset] }
319324 return super. uint64 ( fromBytes: count)
320325 }
321326
@@ -327,6 +332,7 @@ public final class LsbBitReader: ByteReader, BitReader {
327332 */
328333 public override func uint32( ) -> UInt32 {
329334 precondition ( isAligned, " BitReader is not aligned. " )
335+ defer { self . currentByte = self . ptr [ self . _offset] }
330336 return super. uint32 ( fromBytes: 4 )
331337 }
332338
@@ -339,6 +345,7 @@ public final class LsbBitReader: ByteReader, BitReader {
339345 */
340346 public override func uint32( fromBytes count: Int ) -> UInt32 {
341347 precondition ( isAligned, " BitReader is not aligned. " )
348+ defer { self . currentByte = self . ptr [ self . _offset] }
342349 return super. uint32 ( fromBytes: count)
343350 }
344351
@@ -350,6 +357,7 @@ public final class LsbBitReader: ByteReader, BitReader {
350357 */
351358 public override func uint16( ) -> UInt16 {
352359 precondition ( isAligned, " BitReader is not aligned. " )
360+ defer { self . currentByte = self . ptr [ self . _offset] }
353361 return super. uint16 ( fromBytes: 2 )
354362 }
355363
@@ -362,6 +370,7 @@ public final class LsbBitReader: ByteReader, BitReader {
362370 */
363371 public override func uint16( fromBytes count: Int ) -> UInt16 {
364372 precondition ( isAligned, " BitReader is not aligned. " )
373+ defer { self . currentByte = self . ptr [ self . _offset] }
365374 return super. uint16 ( fromBytes: count)
366375 }
367376
0 commit comments