(no commit message)
authorlkcl <lkcl@web>
Wed, 21 Sep 2022 23:27:16 +0000 (00:27 +0100)
committerIkiWiki <ikiwiki.info>
Wed, 21 Sep 2022 23:27:16 +0000 (00:27 +0100)
openpower/prefix_codes.mdwn

index 8b07425c49569a3370250a0cdaa924fb4ac70c0c..40c9054511b0cdae2b35c34877fcb0ba1882a13c 100644 (file)
@@ -10,6 +10,11 @@ This is useful for Huffman codes, and other prefix-codes, which are used a lot i
 * Brotli
 * etc.
 
+Links:
+
+* <https://gist.github.com/kirlf/2eb242f225f9bfed4ecbfc8e1e2f5f71>
+* <https://en.m.wikipedia.org/wiki/Huffman_coding>
+
 # Prefix-code decode description
 
 `pcdec RT,RA,RB,RC,imm`
@@ -62,6 +67,7 @@ Pseudo-code:
     overflow <- 0
     do while in_pos <u 64
         # walk the binary tree in `tree` from parent to the selected child
+        # XXX should this be "in-_bits" not "bitstream"?
         decoded <- decoded * 2 + bitstream[63 - in_pos]
         in_pos <- in_pos + 1
         if decoded >=u 64 then
@@ -72,6 +78,7 @@ Pseudo-code:
             output[56 - 8 * out_byte:63 - 8 * out_byte] <- decoded
             decoded <- 1
             out_byte <- out_byte + 1
+            # XXX if one? if "imm"?
             if one | (out_byte >=u 8) then
                 break
     RT <- output
@@ -83,4 +90,4 @@ Special Registers Altered:
 
 # [DRAFT] Prefix-code encode
 
-TODO
\ No newline at end of file
+TODO