Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Two-byte char to bit array

5 views
Skip to first unread message

Kyongho Min

unread,
Mar 4, 2002, 5:20:51 PM3/4/02
to
Hi there,

Can anyone help me change two-byte char into a bit array.
Otherwise how can I change a char #\A into a bit array.
I'd like to do some bit operation such as "shift 3 bits left".

Thanks in advance,

Kyongho Min

Nils Goesche

unread,
Mar 4, 2002, 5:29:52 PM3/4/02
to
In article <bd09e78f.02030...@posting.google.com>, Kyongho Min wrote:
> Hi there,
>
> Can anyone help me change two-byte char into a bit array.
> Otherwise how can I change a char #\A into a bit array.
> I'd like to do some bit operation such as "shift 3 bits left".

How about doing something like

(ash (char-code #\A) 3)

instead?

Regards,
--
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9

Erik Naggum

unread,
Mar 4, 2002, 5:31:36 PM3/4/02
to
* kyong...@aut.ac.nz (Kyongho Min)

| Can anyone help me change two-byte char into a bit array.
| Otherwise how can I change a char #\A into a bit array.
| I'd like to do some bit operation such as "shift 3 bits left".

Can you do that on a bit array? I have always missed the ability to do
such useful things on bit arrays.

You could probably work with the code-value of the character.
char-code produces an integer that should be amenable to bit-shifting.

///
--
In a fight against something, the fight has value, victory has none.
In a fight for something, the fight is a loss, victory merely relief.

0 new messages