Latest recipes tagged "swap_byte_order" Code RecipesReverse the byte order of an unsigned 'int' or 'long' number in Python (Python) 2008-08-15T14:03:30-07:00Vishal Sapre <p style="color: grey"> Python recipe 576421 by <a href="/recipes/users/4166412/">Vishal Sapre</a> (<a href="/recipes/tags/byte_order/">byte_order</a>, <a href="/recipes/tags/byte_order_reversal/">byte_order_reversal</a>, <a href="/recipes/tags/reverse/">reverse</a>, <a href="/recipes/tags/swap_byte_order/">swap_byte_order</a>). Revision 5. </p> <p>Given an unsigned number, of type 'int' or 'long', this function returns a corresponding number of the same type, with its byte order reversed. So if input = 0xABCDEF, then output = 0xEFCDAB</p>