Skip to content

Instantly share code, notes, and snippets.

@sandeen
Created January 6, 2015 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandeen/823ceb55083dacd2d9bc to your computer and use it in GitHub Desktop.
Save sandeen/823ceb55083dacd2d9bc to your computer and use it in GitHub Desktop.
fix for non-8-bit-multiples
// Packet is 1 bit per byte, pack to 8-bits per byte.
for pIdx := 0; pIdx < len(d.pkt)*8; pIdx++ {
d.pkt[pIdx>>3] <<= 1
if pIdx < d.Cfg.PacketSymbols {
d.pkt[pIdx>>3] |= d.Quantized[qIdx+(pIdx*d.Cfg.SymbolLength2)]
} else { // zero out last bits past PacketSymbols
d.pkt[pIdx>>3] |= 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment