• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
byteorder.h
Go to the documentation of this file.
1 /***************************************************************************
2  byteorder.h - Define byteswapping macros if required
3  -------------------
4  begin : Mon Aug 10 2009 15:29 IST
5  copyright : (c) 2009 by Akarsh Simha
6  email : akarsh.simha@kdemail.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 /*
19 NOTE: This file was written from scratch using several headers written
20 by others as reference. Of particular mention is LICQ's
21 licq_bytorder.h and Oskar Liljeblad's byteswap.h licensed under the
22 GPL.
23 */
24 
25 #ifndef BYTEORDER_H_
26 #define BYTEORDER_H_
27 
28 // Check if we have standard byteswap headers
29 
30 #ifdef HAVE_BYTESWAP_H
31 #include <byteswap.h>
32 
33 #elif defined HAVE_MACHINE_ENDIAN_H
34 #include <machine/endian.h>
35 #define bswap_16(x) swap16(x)
36 #define bswap_32(x) swap32(x)
37 
38 #elif defined HAVE_SYS_BYTEORDER_H
39 #include <sys/byteorder.h>
40 #define bswap_16(x) BSWAP_16(x)
41 #define bswap_32(x) BSWAP_32(x)
42 #endif
43 
44 // If no standard headers are found, we define our own byteswap macros
45 
46 #ifndef bswap_16
47 #define bswap_16(x) ((( (x) & 0x00FF ) << 8) | (( (x) & 0xFF00 ) >> 8))
48 #endif
49 
50 #ifndef bswap_32
51 
52 #define bswap_32(x) ((( (x) & 0x000000FF ) << 24) | (( (x) & 0x0000FF00 ) << 8) \
53  | (( (x) & 0x00FF0000 ) >> 8) | (( (x) & 0xFF000000 ) >> 24))
54 #endif
55 
56 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal