C
Curt Hibbs
------=_Part_4391_5030105.1132698217184
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Does anyone have a clever way to convert an integer to an array of bit
values?
For example (using 8 bit integers):
0 =3D> [0, 0, 0, 0, 0, 0, 0, 0]
1 =3D> [0, 0, 0, 0, 0, 0, 0, 1]
2 =3D> [0, 0, 0, 0, 0, 0, 1, 0]
7 =3D> [0, 0, 0, 0, 0, 1, 1, 1]
etc.
I was looking at Array#pack and Array#unpack to do this, but haven't figure=
d
it out yet. It just seems like there ought to be a simple way to do this.
Anybody got a clever idea?
Curt
------=_Part_4391_5030105.1132698217184--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Does anyone have a clever way to convert an integer to an array of bit
values?
For example (using 8 bit integers):
0 =3D> [0, 0, 0, 0, 0, 0, 0, 0]
1 =3D> [0, 0, 0, 0, 0, 0, 0, 1]
2 =3D> [0, 0, 0, 0, 0, 0, 1, 0]
7 =3D> [0, 0, 0, 0, 0, 1, 1, 1]
etc.
I was looking at Array#pack and Array#unpack to do this, but haven't figure=
d
it out yet. It just seems like there ought to be a simple way to do this.
Anybody got a clever idea?
Curt
------=_Part_4391_5030105.1132698217184--