Re: Bits from a stream
- From: "Alan Manuel K. Gloria" <almkglor@xxxxxxxxx>
- Date: 20 Mar 2006 06:05:45 -0800
Thanks pascal! Basically I'm parsing by octet bytes now, and I'm
twiddling bits (I need a variable-length encoding to take full
advantage of compression, so I need it as a stream of bits).
My write-bit routine is now:
(let
(
(bitn 0)
(byt 0) )
(defun write-bit-flush (stream)
(write-byte byt stream)
(setf bitn 0)
t)
(defun write-bit (bit stream)
(setf (ldb (byte 1 bitn)) bit)
(when (eq 8 (incf bitn))
(write-byte byt stream)
(setf bitn 0))
bit ))
I've tested read-bit way above (which, btw, is little-endian, it
returns the lowest bit first), but write-bit here hasn't been tested
yet. I'm using a var-length encoding to store data from a hash table,
and the hash is big - it would be generated by taking character n-grams
from text documents, and my goal is to store the hash table in less
space than the original file.
.
- Follow-Ups:
- Re: Bits from a stream
- From: Alan Manuel K. Gloria
- Re: Bits from a stream
- References:
- Bits from a stream
- From: Alan Manuel K. Gloria
- Re: Bits from a stream
- From: Zach Beane
- Re: Bits from a stream
- From: Peter Seibel
- Bits from a stream
- Prev by Date: Re: Bits from a stream
- Next by Date: Re: Graphic-Forms screenshots
- Previous by thread: Re: Bits from a stream
- Next by thread: Re: Bits from a stream
- Index(es):