"Fossies" - the Fresh Open Source Software Archive

Member "usr/include/bits/byteswap.h" (19 Aug 2019, 756 Bytes) of package /windows/misc/cygwin-20190819-x86.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* bits/byteswap.h
    2 
    3 This file is part of Cygwin.
    4 
    5 This software is a copyrighted work licensed under the terms of the
    6 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
    7 details. */
    8 
    9 #ifndef _BITS_BYTESWAP_H
   10 #define _BITS_BYTESWAP_H
   11 
   12 #ifdef __cplusplus
   13 extern "C" {
   14 #endif
   15 
   16 static __inline unsigned short
   17 __bswap_16 (unsigned short __x)
   18 {
   19   return (__x >> 8) | (__x << 8);
   20 }
   21 
   22 static __inline unsigned int
   23 __bswap_32 (unsigned int __x)
   24 {
   25   return (__bswap_16 (__x & 0xffff) << 16) | (__bswap_16 (__x >> 16));
   26 }
   27 
   28 static __inline unsigned long long
   29 __bswap_64 (unsigned long long __x)
   30 {
   31   return (((unsigned long long) __bswap_32 (__x & 0xffffffffull)) << 32) | (__bswap_32 (__x >> 32));
   32 }
   33 
   34 #ifdef __cplusplus
   35 }
   36 #endif
   37 #endif /* _BITS_BYTESWAP_H */