fix copy ctors in bit_buffer_t

master
Andre Puschmann 6 years ago
parent 481a1829dd
commit 3f36594f1e

@ -216,13 +216,16 @@ struct bit_buffer_t{
#endif #endif
} }
bit_buffer_t(const bit_buffer_t& buf){ bit_buffer_t(const bit_buffer_t& buf){
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
N_bits = buf.N_bits; N_bits = buf.N_bits;
memcpy(msg, buf.msg, N_bits); memcpy(msg, buf.msg, N_bits);
} }
bit_buffer_t & operator= (const bit_buffer_t & buf){ bit_buffer_t & operator= (const bit_buffer_t & buf){
// avoid self assignment // avoid self assignment
if (&buf == this) if (&buf == this) {
return *this; return *this;
}
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
N_bits = buf.N_bits; N_bits = buf.N_bits;
memcpy(msg, buf.msg, N_bits); memcpy(msg, buf.msg, N_bits);
return *this; return *this;

Loading…
Cancel
Save