### __reverse2 -- Reverse the Bytes in a 2 Byte Value

Format

>     #include <builtin.h>

>     unsigned short __reverse2(unsigned short num)

Language Level: None
__reverse2 reverses the byte order of num.

Return Value
Returns the byte reversed value.

Example
This example reverses the bytes of foo and prints out both the original and new values.

    #include <stdio.h>
    #include <builtin.h>

    unsigned short foo = 0x0102;

    int main(void)
    {
       printf("foo = %.4hx  foo byte reversed = %.4hx\n",
              foo, __reverse2(foo));

       /*****************************************
          The output should be:

          foo = 0102  foo byte reversed = 0201
       *****************************************/

       return 0;
    }

__reverse4 -- Reverse the Bytes in a 4 Byte Value
__reverse8 -- Reverse the Bytes in a 8 Byte Value