endian.h (d846855da8c8142a2f647f7a4c6949b341261297) | endian.h (7f0f1cfd575a7fa1b47211947f3ab05ba28452b2) |
---|---|
1/*- 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45 */ 46#define _QUAD_HIGHWORD 0 47#define _QUAD_LOWWORD 1 48 49/* 50 * Definitions for byte order, according to byte significance from low 51 * address to high. 52 */ | 1/*- 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45 */ 46#define _QUAD_HIGHWORD 0 47#define _QUAD_LOWWORD 1 48 49/* 50 * Definitions for byte order, according to byte significance from low 51 * address to high. 52 */ |
53#ifndef _POSIX_SOURCE 54#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ 55#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ 56#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ | 53#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ 54#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ 55#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ |
57 | 56 |
58#define BYTE_ORDER BIG_ENDIAN 59#endif /* !_POSIX_SOURCE */ | 57#define _BYTE_ORDER _BIG_ENDIAN |
60 | 58 |
59/* 60 * Deprecated variants that don't have enough underscores to be useful in more 61 * strict namespaces. 62 */ 63#if __BSD_VISIBLE 64#define LITTLE_ENDIAN _LITTLE_ENDIAN 65#define BIG_ENDIAN _BIG_ENDIAN 66#define PDP_ENDIAN _PDP_ENDIAN 67#define BYTE_ORDER _BYTE_ORDER 68#endif 69 |
|
61#ifdef __GNUC__ 62 63static __inline __uint16_t 64__bswap16(__uint16_t _x) 65{ 66 67 return ((_x >> 8) | ((_x << 8) & 0xff00)); 68} --- 27 unchanged lines hidden --- | 70#ifdef __GNUC__ 71 72static __inline __uint16_t 73__bswap16(__uint16_t _x) 74{ 75 76 return ((_x >> 8) | ((_x << 8) & 0xff00)); 77} --- 27 unchanged lines hidden --- |