__bswap.c.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. __bswap.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='BootParameters2.c.html' title=' BootParameters2.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='bytespec.c.html' title=' bytespec.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * __bswap.c - byte swap functions;
  24. *
  25. * endian.h
  26. *
  27. * alternative byte-swap functions for systems without them (such
  28. * as Microsoft Windows);
  29. *
  30. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  31. * Copyright (c) 2001-2006 by Charles Maier Associates;
  32. * Licensed under the Internet Software Consortium License;
  33. *
  34. *--------------------------------------------------------------------*/
  35. #ifndef __BSWAP_SOURCE
  36. #define __BSWAP_SOURCE
  37. #include &lt;stdint.h&gt;
  38. #include &quot;../tools/endian.h&quot;
  39. #include &quot;../tools/memory.h&quot;
  40. uint16_t __bswap_16 (uint16_t x)
  41. {
  42. reverse (&amp;x, sizeof (x));
  43. return (x);
  44. }
  45. uint32_t __bswap_32 (uint32_t x)
  46. {
  47. reverse (&amp;x, sizeof (x));
  48. return (x);
  49. }
  50. uint64_t __bswap_64 (uint64_t x)
  51. {
  52. reverse (&amp;x, sizeof (x));
  53. return (x);
  54. }
  55. #endif
  56. </pre>
  57. <div class='footerlink'>
  58. [<a href='BootParameters2.c.html' title=' BootParameters2.c '>PREV</a>]
  59. [<a href='toolkit.html' title=' Index '>HOME</a>]
  60. [<a href='bytespec.c.html' title=' bytespec.c '>NEXT</a>]
  61. </div>
  62. </body>
  63. </html>