1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-17 18:06:03 -05:00

d2common/d2datautils/StreamWriter: add Align method

This commit is contained in:
gucio321 2021-05-18 19:49:47 +02:00
parent 8d982b4611
commit 1224a38796

View File

@ -136,3 +136,10 @@ func (v *StreamWriter) PushUint64(val uint64) {
v.data.WriteByte(byte(val >> 48))
v.data.WriteByte(byte(val >> 56))
}
// Align aligns stream writer to bytes
func (v *StreamWriter) Align() {
if o := v.bitOffset % bitsPerByte; o > 0 {
v.PushBits(0, bitsPerByte-o)
}
}