diff options
Diffstat (limited to 'zutil.h')
| -rw-r--r-- | zutil.h | 26 |
1 files changed, 26 insertions, 0 deletions
| @@ -254,4 +254,30 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
| 254 | #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ | 254 | #define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ |
| 255 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) | 255 | (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) |
| 256 | 256 | ||
| 257 | #ifdef MAKEFIXED | ||
| 258 | # ifndef BUILDFIXED | ||
| 259 | # define BUILDFIXED | ||
| 260 | # endif | ||
| 261 | #endif | ||
| 262 | #if defined(BUILDFIXED) || defined(DYNAMIC_CRC_TABLE) | ||
| 263 | /* Structure for z_once(), which must be initialized with Z_ONCE_INIT. */ | ||
| 264 | typedef struct z_once_s z_once_t; | ||
| 265 | void ZLIB_INTERNAL z_once(z_once_t *state, void (*init)(void)); | ||
| 266 | #if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ | ||
| 267 | !defined(__STDC_NO_ATOMICS__) | ||
| 268 | #include <stdatomic.h> | ||
| 269 | struct z_once_s { | ||
| 270 | atomic_flag begun; | ||
| 271 | atomic_int done; | ||
| 272 | }; | ||
| 273 | #define Z_ONCE_INIT {ATOMIC_FLAG_INIT, 0} | ||
| 274 | #else /* no atomics! */ | ||
| 275 | struct z_once_s { | ||
| 276 | volatile int begun; | ||
| 277 | volatile int done; | ||
| 278 | }; | ||
| 279 | #define Z_ONCE_INIT {0, 0} | ||
| 280 | #endif | ||
| 281 | #endif | ||
| 282 | |||
| 257 | #endif /* ZUTIL_H */ | 283 | #endif /* ZUTIL_H */ |
