Skip to content

Instantly share code, notes, and snippets.

@sandeen
Created January 5, 2015 21:43
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/7bab652509d58192bfe6 to your computer and use it in GitHub Desktop.
Save sandeen/7bab652509d58192bfe6 to your computer and use it in GitHub Desktop.
decode patch
@@ -265,6 +259,15 @@ func (d Decoder) Decode(input []byte) (pkts [][]byte) {
d.pkt[pIdx>>3] |= d.Quantized[qIdx+(pIdx*d.Cfg.SymbolLength2)]
}
+ // Left over bits?
+ r := (8 - (d.Cfg.PacketSymbols % 8))
+ if r > 0 {
+ for pIdx := 0; pIdx < r; pIdx++ {
+ d.pkt[(d.Cfg.PacketSymbols-1)>>3] <<= 1
+ d.pkt[(d.Cfg.PacketSymbols-1)>>3] |= 0
+ }
+ }
+
// Store the packet in the seen map and append to the packet list.
pktStr := fmt.Sprintf("%02X", d.pkt)
if !seen[pktStr] {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment