8000 Allocate proper byte count in InputMemoryBitStream copy constructor, … · githubbadguy/MultiplayerBook@11ee617 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11ee617

Browse files
author
Joshua Glazer
committed
Allocate proper byte count in InputMemoryBitStream copy constructor, thanks to mwistauder!
1 parent 8d4af44 commit 11ee617

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Chapter 4/RoboCat/Inc/MemoryBitStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class InputMemoryBitStream
9797
mIsBufferOwner( true )
9898
{
9999
//allocate buffer of right size
100-
int byteCount = mBitCapacity / 8;
100+
int byteCount = ( mBitCapacity + 7 ) / 8;
101101
mBuffer = static_cast< char* >( malloc( byteCount ) );
102102
//copy
103103
memcpy( mBuffer, inOther.mBuffer, byteCount );

0 commit comments

Comments
 (0)
0