Back to index

glibc  2.9
Functions
tst-bswap.c File Reference
#include <byteswap.h>
#include <stdio.h>

Go to the source code of this file.

Functions

unsigned long long int wash (unsigned long long int a)
int main (void)

Function Documentation

int main ( void  )

Definition at line 26 of file tst-bswap.c.

{
  int result = 0;

  /* Test the functions with constant arguments.  */
  if (bswap_16 (0x1234) != 0x3412)
    {
      puts ("bswap_16 (constant) flunked");
      result = 1;
    }
  if (bswap_32 (0x12345678) != 0x78563412)
    {
      puts ("bswap_32 (constant) flunked");
      result = 1;
    }
  if (bswap_64 (0x1234567890abcdefULL) != 0xefcdab9078563412ULL)
    {
      puts ("bswap_64 (constant) flunked");
      result = 1;
    }

  /* Test the functions with non-constant arguments.  */
  if (bswap_16 (wash (0x1234)) != 0x3412)
    {
      puts ("bswap_16 (non-constant) flunked");
      result = 1;
    }
  if (bswap_32 (wash (0x12345678)) != 0x78563412)
    {
      puts ("bswap_32 (non-constant) flunked");
      result = 1;
    }
  if (bswap_64 (wash (0x1234567890abcdefULL)) != 0xefcdab9078563412ULL)
    {
      puts ("bswap_64 (non-constant) flunked");
      result = 1;
    }

  return result;
}

Here is the call graph for this function:

unsigned long long int wash ( unsigned long long int  a)

Definition at line 69 of file tst-bswap.c.

{
  /* Do nothing.  This function simply exists to avoid that the compiler
     regards the argument to the bswap_*() functions as constant.  */
  return a + 0;
}

Here is the caller graph for this function: