Re: Bits from a stream
- From: Zach Beane <xach@xxxxxxxx>
- Date: 20 Mar 2006 08:29:55 -0500
"Alan Manuel K. Gloria" <almkglor@xxxxxxxxx> writes:
I'm currently trying to figure out how bits work in CL.
You can access the bits of an integer with functions like LDB and
LOGAND. You can produce integers with modified bits with functions
like DPB and LOGIOR. You can perform bitwise shifts with ASH. You can
test individual bits with LOGBITP or groups of bits with LOGTEST.
There are many more functions for accessing and operating on the bits
of an integer. See the numbers dictionary for a list:
http://www.lispworks.com/documentation/HyperSpec/Body/c_number.htm
Basically I need to do some compression on some data I'm storing - the
way I keep my data is rather amenable to compression, but compressing
it requires access to individual bits. I would like to store and
retrieve data from a file, so I will need access to bits in a stream.
I have written a few bitstream functions for a Flash file
reader/writer. They are available here:
http://www.xach.com/lisp/cl-flash/bitio.lisp
It will allow you to both read and write variable-length contiguous
bits across octet boundaries in an (UNSIGNED-BYTE 8) stream. There
isn't much to it.
Okay, so maybe I'll dredge through the hyperspec and figure out what
names CL gives to bitwise or/and and bit shifting.
This is a very good idea in general.
Zach
.
- Follow-Ups:
- Re: Bits from a stream
- From: Alan Manuel K. Gloria
- Re: Bits from a stream
- From: Peter Seibel
- Re: Bits from a stream
- References:
- Bits from a stream
- From: Alan Manuel K. Gloria
- Bits from a stream
- Prev by Date: Re: Bits from a stream
- Next by Date: Re: Bits from a stream
- Previous by thread: Re: Bits from a stream
- Next by thread: Re: Bits from a stream
- Index(es):
Relevant Pages
|