The web conversion (www.parrotcode.org/docs) results in a blank page as this file isn't PODified. Patch remedies.
(I forget whether attachments are verboten or preferred - I can't seem to find any included documentation on how to submit patches. I should probably add that to the list of things I won't get to.) -- Bryan C. Warnock bwarnock@(gtemail.net|raba.com)
Index: byteorder.dev =================================================================== RCS file: /cvs/public/parrot/docs/dev/byteorder.dev,v retrieving revision 1.1 diff -u -r1.1 byteorder.dev --- byteorder.dev 19 Jul 2002 02:56:56 -0000 1.1 +++ byteorder.dev 27 Aug 2002 02:44:10 -0000 @@ -1,6 +1,11 @@ -Overview -The byteorder code will check the endianness of an INTVAL or -an opcode_t value and swap from little to big, or big to little +=head1 Name + + byteorder.dev + +=head1 Overview + +The byteorder code will check the endianness of an C<INTVAL> or +an C<opcode_t> value and swap from little to big, or big to little when appropriate. Functions also exist to convert a 4, 8, 12, or 16 byte character buffer to big or little endian. The functions will be placed in the PackFile @@ -8,10 +13,11 @@ the Parrot interpreter will not call these functions when converting from and to the same byteorder. -Data Structures and Algorithms +=head1 Data Structures and Algorithms + The algorithm to change from one endian to another is identical and simplistic to understand. Basically, -the size of an INTVAL or opcode_t is used to +the size of an C<INTVAL> or C<opcode_t> is used to determine at compile time how many bits should be shifted around. Then, the correct bits are shifted the correct amounts (please look at source code for @@ -19,39 +25,73 @@ by a straight forward algorithm that assigns swaps all of the bytes. -Important Functions -fetch_iv_le - This function will convert an INTVAL into -little endian format. It is a noop if the native +=head1 Important Functions + +=over 4 + +=item C<fetch_iv_le> + +This function will convert an C<INTVAL> into +little endian format. It is a no-op if the native format is already little endian. -fetch_iv_be - This function will convert an INTVAL into -big endian format. It is a noop if the native + +=item C<fetch_iv_be> + +This function will convert an C<INTVAL> into +big endian format. It is a no-op if the native format is already big endian. -fetch_op_be - This function will convert an opcode_t into -big endian format. It is a noop if the native + +=item C<fetch_op_be> + +This function will convert an C<opcode_t> into +big endian format. It is a no-op if the native format is already big endian. -fetch_op_le - This function will convert an opcode_t into -little endian fommat. It is a noop if the native + +=item C<fetch_op_le> + +This function will convert an C<opcode_t> into +little endian format. It is a no-op if the native format is already little endian. -fetch_buf_le_(4,8,12,16) - This set of functions + +=item C<fetch_buf_le_>(4,8,12,16) + +This set of functions will convert an unsigned character buffer into -little endian format. Only a memcpy is performed +little endian format. Only a C<memcpy> is performed if the native format is already little endian. -fetch_buf_be_(4,8,12,16) - This set of functions + +=item C<fetch_buf_be_>(4,8,12,16) + +This set of functions will convert an unsigned character buffer into -big endian format. Only a memcpy is performed +big endian format. Only a C<memcpy> is performed if the native format is already big endian. -Unimplemented Functions -endianize_fetch_int - fetch an INTVAL directly from a bytestream -endianize_put_int - put an INTVAL directly on a bytestream +=back + +=head1 Unimplemented Functions + +=over 4 + +=item C<endianize_fetch_int> + +fetch an C<INTVAL> directly from a bytestream + +=item C<endianize_put_int> + +put an C<INTVAL> directly on a bytestream + +=back + +=head1 History -History Initial version by Melvin on 2002/05/01 -Notes +=head1 Notes + This assumes big or little endianness...other, more esoteric forms (such as middle endian) are not supported. -Also, an assumption of 4 or 8 byte INTVAL's -and opcode_t's is made. +Also, an assumption of 4 or 8 byte C<INTVAL>'s +and C<opcode_t>'s is made. -References +=head1 References