The packed-binary collection on PLaneT can convert between various binary formats and byte strings. It's patterned after a similar capability in Python.<br><br><div class="gmail_quote">On Sat, Apr 11, 2009 at 7:52 AM, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org">eli@barzilay.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Apr 11, Erich Rast wrote:<br>
> Hi all,<br>
><br>
> I'm a bit confused about numbers. A fixnum can hold numbers that fit<br>
> into 31 or 63 bits depending on whether the machine is 32 bit or 64<br>
> bit, right?<br>
><br>
> How do I convert a positive integer number in the range from<br>
> 0...4294967295 (inclusive) on any machine to a little-endian encoded 4-<br>
> element bytes string?<br>
<br>
</div></div>You can use (integer->integer-bytes 4294967295 4 #f #f) -- with #f for<br>
the `signed?' flag, since otherwise it doesn't fit into 4 bytes.<br>
<font color="#888888"><br>
--<br>
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:<br>
<a href="http://www.barzilay.org/" target="_blank">http://www.barzilay.org/</a> Maze is Life!<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</font></blockquote></div><br>