Unsigned Integer Encoding

Peter Jeremy peter at rulingia.com
Wed Aug 15 08:51:21 UTC 2012


On 2012-Aug-15 10:33:46 +0200, Daniel Grech <dgre090 at gmail.com> wrote:
>Hi,
>
>I have what is probably a really elementary question but I can't seem to
>figure it out. In the following snippet of code, why is it that a and b do
>not have the same value in the end ?  :

See http://en.wikipedia.org/wiki/Endian

>Im asking this as I am currently encoding a protocol in which i receive
>data as a sequence of bytes. Casting for example 4 bytes from this stream
>leaves me with the situation in variable b, while the situation I am
>looking to accomplish is the one in A (i.e. the bytes are not encoded in
>reverse form).

I suggest you look at xdr(3) and rpcgen(1)

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20120815/fb7f8617/attachment.pgp


More information about the freebsd-hackers mailing list