| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
#ifndef CSOUND_SYSDEP_H |
| 25 |
#define CSOUND_SYSDEP_H |
| 26 |
|
| 27 |
|
| 28 |
#if defined(WIN32) |
| 29 |
#if !defined(locale_t) |
| 30 |
typedef void *locale_t; |
| 31 |
#endif |
| 32 |
#endif |
| 33 |
|
| 34 |
#include <limits.h> |
| 35 |
|
| 36 |
#if defined(__MACH__) || defined(LINUX) |
| 37 |
#if ( __WORDSIZE == 64 ) || defined(__x86_64__) || defined(__amd64__) |
| 38 |
#define B64BIT |
| 39 |
#endif |
| 40 |
#endif |
| 41 |
|
| 42 |
#if defined(WIN32) |
| 43 |
#if _WIN64 |
| 44 |
#define B64BIT |
| 45 |
#endif |
| 46 |
#endif |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
#ifdef HAVE_GCC3 |
| 51 |
# undef HAVE_GCC3 |
| 52 |
#endif |
| 53 |
#ifdef HAVE_C99 |
| 54 |
# undef HAVE_C99 |
| 55 |
#endif |
| 56 |
#if (defined(__GNUC__) && (__GNUC__ >= 3)) |
| 57 |
# define HAVE_C99 1 |
| 58 |
# if defined(__BUILDING_LIBCSOUND) || defined(CSOUND_CSDL_H) |
| 59 |
# ifndef _ISOC99_SOURCE |
| 60 |
# define _ISOC99_SOURCE 1 |
| 61 |
# endif |
| 62 |
# ifndef _ISOC9X_SOURCE |
| 63 |
# define _ISOC9X_SOURCE 1 |
| 64 |
# endif |
| 65 |
# endif |
| 66 |
# if !(defined(__MACH__) && (__GNUC__ == 3) && (__GNUC_MINOR__ < 2)) |
| 67 |
# define HAVE_GCC3 1 |
| 68 |
# endif |
| 69 |
#elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) |
| 70 |
# define HAVE_C99 1 |
| 71 |
#endif |
| 72 |
|
| 73 |
#if defined(__GNUC__) |
| 74 |
# if defined(__GNUC_PATCHLEVEL__) |
| 75 |
# define __GNUC_VERSION__ (__GNUC__ * 10000 \ |
| 76 |
+ __GNUC_MINOR__ * 100 \ |
| 77 |
+ __GNUC_PATCHLEVEL__) |
| 78 |
# else |
| 79 |
# define __GNUC_VERSION__ (__GNUC__ * 10000 \ |
| 80 |
+ __GNUC_MINOR__ * 100) |
| 81 |
# endif |
| 82 |
#endif |
| 83 |
|
| 84 |
#ifndef CABBAGE |
| 85 |
#ifdef MSVC |
| 86 |
typedef __int32 int32; |
| 87 |
typedef __int16 int16; |
| 88 |
typedef unsigned __int32 uint32; |
| 89 |
typedef unsigned __int16 uint16; |
| 90 |
#else |
| 91 |
#include <stdint.h> |
| 92 |
typedef int_least32_t int32; |
| 93 |
typedef int_least16_t int16; |
| 94 |
typedef uint_least32_t uint32; |
| 95 |
typedef uint_least16_t uint16; |
| 96 |
#endif |
| 97 |
#endif |
| 98 |
|
| 99 |
#if defined(HAVE_PTHREAD_SPIN_LOCK) |
| 100 |
#include <pthread.h> |
| 101 |
#endif |
| 102 |
|
| 103 |
#ifdef __MACH__ |
| 104 |
#include <AvailabilityMacros.h> |
| 105 |
#endif |
| 106 |
|
| 107 |
#if !defined(USE_DOUBLE) |
| 108 |
#if !defined(_MSC_VER) |
| 109 |
#include "float-version.h" |
| 110 |
#else |
| 111 |
#define USE_DOUBLE |
| 112 |
#endif |
| 113 |
#endif |
| 114 |
|
| 115 |
#ifdef USE_DOUBLE |
| 116 |
|
| 117 |
#define MYRECIPLN2 1.442695040888963407359924681001892137426 |
| 118 |
#define LOG2(a) (MYRECIPLN2*log(a)) |
| 119 |
|
| 120 |
#define ACOS acos |
| 121 |
#define ASIN asin |
| 122 |
#define ATAN atan |
| 123 |
#define ATAN2 atan2 |
| 124 |
#define COS cos |
| 125 |
#define SIN sin |
| 126 |
#define TAN tan |
| 127 |
#define COSH cosh |
| 128 |
#define SINH sinh |
| 129 |
#define TANH tanh |
| 130 |
#define ACOSH acosh |
| 131 |
#define ASINH asinh |
| 132 |
#define ATANH atanh |
| 133 |
#define EXP exp |
| 134 |
#define LOG log |
| 135 |
#define LOG10 log10 |
| 136 |
|
| 137 |
#define POWER pow |
| 138 |
#define SQRT sqrt |
| 139 |
#define HYPOT hypot |
| 140 |
#define FABS fabs |
| 141 |
#define FLOOR floor |
| 142 |
#define CEIL ceil |
| 143 |
#define FMOD fmod |
| 144 |
#define MODF modf |
| 145 |
#else |
| 146 |
|
| 147 |
#define MYRECIPLN2 1.442695040888963407359924681001892137426 |
| 148 |
#define LOG2(a) (MYRECIPLN2*logf(a)) |
| 149 |
|
| 150 |
#define ACOS acosf |
| 151 |
#define ASIN asinf |
| 152 |
#define ATAN atanf |
| 153 |
#define ATAN2 atan2f |
| 154 |
#define COS cosf |
| 155 |
#define SIN sinf |
| 156 |
#define TAN tanf |
| 157 |
#define COSH coshf |
| 158 |
#define SINH sinhf |
| 159 |
#define TANH tanhf |
| 160 |
#define ACOSH acoshf |
| 161 |
#define ASINH asinhf |
| 162 |
#define ATANH atanhf |
| 163 |
#define EXP expf |
| 164 |
#define LOG logf |
| 165 |
#define LOG10 log10f |
| 166 |
|
| 167 |
#define POWER powf |
| 168 |
#define SQRT sqrtf |
| 169 |
#define HYPOT hypotf |
| 170 |
#define FABS(x) fabsf(FL(x)) |
| 171 |
#define FLOOR floorf |
| 172 |
#define CEIL ceilf |
| 173 |
#define FMOD fmodf |
| 174 |
#define MODF modff |
| 175 |
#endif |
| 176 |
|
| 177 |
#include <stdio.h> |
| 178 |
#include <stdlib.h> |
| 179 |
#include <math.h> |
| 180 |
#include <string.h> |
| 181 |
#if defined(HAVE_FCNTL_H) || defined(__unix) || defined(__unix__) |
| 182 |
#include <fcntl.h> |
| 183 |
#endif |
| 184 |
#if defined(HAVE_UNISTD_H) || defined(__unix) || defined(__unix__) |
| 185 |
#include <unistd.h> |
| 186 |
#endif |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
#ifndef __MYFLT_DEF |
| 191 |
# define __MYFLT_DEF |
| 192 |
# ifndef USE_DOUBLE |
| 193 |
# define MYFLT float |
| 194 |
# else |
| 195 |
# define MYFLT double |
| 196 |
# endif |
| 197 |
#endif |
| 198 |
|
| 199 |
|
| 200 |
#define CS_FLOAT_ALIGN(x) ((int)(x + 7) & (~7)) |
| 201 |
|
| 202 |
#if defined(__BUILDING_LIBCSOUND) || defined(CSOUND_CSDL_H) |
| 203 |
|
| 204 |
#define FL(x) ((MYFLT) (x)) |
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
#if defined(_WIN32) || defined(__WIN32__) |
| 209 |
# ifndef WIN32 |
| 210 |
# define WIN32 1 |
| 211 |
# endif |
| 212 |
#elif (defined(linux) || defined(__linux)) && !defined(LINUX) |
| 213 |
# define LINUX 1 |
| 214 |
#endif |
| 215 |
|
| 216 |
#if defined(WIN32) && defined(_MSC_VER) && !defined(__GNUC__) |
| 217 |
# ifndef MSVC |
| 218 |
# define MSVC 1 |
| 219 |
# endif |
| 220 |
#elif defined(MSVC) |
| 221 |
# undef MSVC |
| 222 |
#endif |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
#if !(defined(__cplusplus) || defined(inline)) |
| 228 |
# if defined(HAVE_C99) || defined(HAVE_GCC3) |
| 229 |
# if defined(__GNUC__) && defined(__STRICT_ANSI__) |
| 230 |
# define inline __inline__ |
| 231 |
# endif |
| 232 |
# elif defined(MSVC) |
| 233 |
# define inline __inline |
| 234 |
# else |
| 235 |
# define inline |
| 236 |
# endif |
| 237 |
#endif |
| 238 |
|
| 239 |
#define DIRSEP '/' |
| 240 |
#ifdef WIN32 |
| 241 |
# undef DIRSEP |
| 242 |
# define DIRSEP '\\' |
| 243 |
# if !defined(O_NDELAY) |
| 244 |
# define O_NDELAY (0) |
| 245 |
# endif |
| 246 |
# include <io.h> |
| 247 |
#else |
| 248 |
# ifdef DOSGCC |
| 249 |
# if !defined(O_NDELAY) |
| 250 |
# define O_NDELAY (0) |
| 251 |
# endif |
| 252 |
# endif |
| 253 |
# ifdef HAVE_SYS_TYPES_H |
| 254 |
# include <sys/types.h> |
| 255 |
# endif |
| 256 |
|
| 257 |
#endif |
| 258 |
#ifndef MSVC |
| 259 |
# include <sys/file.h> |
| 260 |
#endif |
| 261 |
#include <sys/stat.h> |
| 262 |
|
| 263 |
#endif |
| 264 |
|
| 265 |
#ifdef WIN32 |
| 266 |
# define ENVSEP ';' |
| 267 |
#else |
| 268 |
# define ENVSEP ':' |
| 269 |
#endif |
| 270 |
|
| 271 |
|
| 272 |
#if defined(USE_GUSI2) |
| 273 |
|
| 274 |
|
| 275 |
typedef int64_t int_least64_t; |
| 276 |
typedef uint64_t uint_least64_t; |
| 277 |
#elif defined(HAVE_STDINT_H) || defined(HAVE_C99) |
| 278 |
# include <stdint.h> |
| 279 |
|
| 280 |
# if defined(__CYGWIN__) |
| 281 |
#define __int8 char |
| 282 |
#define __int16 short |
| 283 |
#define __int32 int |
| 284 |
#define __int64 long long |
| 285 |
# endif |
| 286 |
#else |
| 287 |
typedef signed char int8_t; |
| 288 |
typedef unsigned char uint8_t; |
| 289 |
typedef short int16_t; |
| 290 |
typedef unsigned short uint16_t; |
| 291 |
typedef int int32_t; |
| 292 |
typedef unsigned int uint32_t; |
| 293 |
# if defined(__GNUC__) || !defined(WIN32) |
| 294 |
typedef long long int64_t; |
| 295 |
typedef unsigned long long uint64_t; |
| 296 |
typedef long long int_least64_t; |
| 297 |
typedef unsigned long long uint_least64_t; |
| 298 |
# else |
| 299 |
typedef __int64 int64_t; |
| 300 |
typedef unsigned __int64 uint64_t; |
| 301 |
typedef __int64 int_least64_t; |
| 302 |
typedef unsigned __int64 uint_least64_t; |
| 303 |
# endif |
| 304 |
#if !defined(_MSC_VER) |
| 305 |
typedef long intptr_t; |
| 306 |
typedef unsigned long uintptr_t; |
| 307 |
#endif |
| 308 |
#endif |
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
#if defined(HAVE_GCC3) && !defined(SWIG) |
| 315 |
|
| 316 |
# define CS_DEPRECATED __attribute__ ((__deprecated__)) |
| 317 |
|
| 318 |
# define CS_NOINLINE __attribute__ ((__noinline__)) |
| 319 |
|
| 320 |
# define CS_NORETURN __attribute__ ((__noreturn__)) |
| 321 |
|
| 322 |
# define CS_PRINTF1 __attribute__ ((__format__ (__printf__, 1, 2))) |
| 323 |
|
| 324 |
# define CS_PRINTF2 __attribute__ ((__format__ (__printf__, 2, 3))) |
| 325 |
|
| 326 |
# define CS_PRINTF3 __attribute__ ((__format__ (__printf__, 3, 4))) |
| 327 |
|
| 328 |
# define CS_PURE __attribute__ ((__pure__)) |
| 329 |
#else |
| 330 |
# define CS_DEPRECATED |
| 331 |
# define CS_NOINLINE |
| 332 |
# define CS_NORETURN |
| 333 |
# define CS_PRINTF1 |
| 334 |
# define CS_PRINTF2 |
| 335 |
# define CS_PRINTF3 |
| 336 |
# define CS_PURE |
| 337 |
#endif |
| 338 |
#if defined(__clang__) || defined(HAVE_GCC3) |
| 339 |
# define LIKELY(x) __builtin_expect(!!(x),1) |
| 340 |
# define UNLIKELY(x) __builtin_expect(!!(x),0) |
| 341 |
#else |
| 342 |
# define LIKELY(x) x |
| 343 |
# define UNLIKELY(x) x |
| 344 |
#endif |
| 345 |
|
| 346 |
#if defined(__BUILDING_LIBCSOUND) || defined(CSOUND_CSDL_H) |
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
#ifdef USE_LRINT |
| 353 |
# ifndef USE_DOUBLE |
| 354 |
# define MYFLT2LONG(x) (x > LONG_MIN && x < LONG_MAX ? \ |
| 355 |
(int32) lrintf((float) (x)) : 0) |
| 356 |
# define MYFLT2LRND(x) (x > LONG_MIN && x < LONG_MAX ? \ |
| 357 |
(int32) lrintf((float) (x)) : 0) |
| 358 |
# else |
| 359 |
# define MYFLT2LONG(x) (x > LONG_MIN && x < LONG_MAX ? \ |
| 360 |
(int32) lrint((double) (x)) : 0) |
| 361 |
# define MYFLT2LRND(x) (x > LONG_MIN && x < LONG_MAX ? \ |
| 362 |
(int32) lrint((double) (x)) : 0) |
| 363 |
# endif |
| 364 |
#elif defined(MSVC) |
| 365 |
#include <emmintrin.h> |
| 366 |
# ifndef USE_DOUBLE |
| 367 |
|
| 368 |
static inline int MYFLT2LONG (float const x) { |
| 369 |
return _mm_cvtss_si32 (_mm_load_ss (&x)); |
| 370 |
} |
| 371 |
|
| 372 |
static inline int MYFLT2LRND (float const x) { |
| 373 |
return _mm_cvtss_si32 (_mm_load_ss (&x)); |
| 374 |
} |
| 375 |
|
| 376 |
# else |
| 377 |
static inline int MYFLT2LONG (double const x) { |
| 378 |
return _mm_cvtsd_si32 (_mm_load_sd (&x)); |
| 379 |
} |
| 380 |
|
| 381 |
static inline int MYFLT2LRND (double const x) { |
| 382 |
return _mm_cvtsd_si32 (_mm_load_sd (&x)); |
| 383 |
} |
| 384 |
# endif |
| 385 |
#else |
| 386 |
# ifndef USE_DOUBLE |
| 387 |
# define MYFLT2LONG(x) ((int32) (x)) |
| 388 |
# if defined(HAVE_GCC3) && defined(__i386__) && !defined(__ICC) |
| 389 |
# define MYFLT2LRND(x) ((int32) lrintf((float) (x))) |
| 390 |
# else |
| 391 |
static inline int32 MYFLT2LRND(float fval) |
| 392 |
{ |
| 393 |
return ((int32) (fval + (fval < 0.0f ? -0.5f : 0.5f))); |
| 394 |
} |
| 395 |
# endif |
| 396 |
# else |
| 397 |
# define MYFLT2LONG(x) ((int32) (x)) |
| 398 |
# if defined(HAVE_GCC3) && defined(__i386__) && !defined(__ICC) |
| 399 |
# define MYFLT2LRND(x) ((int32) lrint((double) (x))) |
| 400 |
# else |
| 401 |
static inline int32 MYFLT2LRND(double fval) |
| 402 |
{ |
| 403 |
return ((int32) (fval + (fval < 0.0 ? -0.5 : 0.5))); |
| 404 |
} |
| 405 |
# endif |
| 406 |
# endif |
| 407 |
#endif |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
#if defined(__i386__) || defined(MSVC) |
| 412 |
static inline float csoundUndenormalizeFloat(float x) |
| 413 |
{ |
| 414 |
volatile float tmp = 1.0e-30f; |
| 415 |
return ((x + 1.0e-30f) - tmp); |
| 416 |
} |
| 417 |
|
| 418 |
static inline double csoundUndenormalizeDouble(double x) |
| 419 |
{ |
| 420 |
volatile double tmp = 1.0e-200; |
| 421 |
return ((x + 1.0e-200) - tmp); |
| 422 |
} |
| 423 |
#else |
| 424 |
# define csoundUndenormalizeFloat(x) x |
| 425 |
# define csoundUndenormalizeDouble(x) x |
| 426 |
#endif |
| 427 |
|
| 428 |
#ifndef USE_DOUBLE |
| 429 |
# define csoundUndenormalizeMYFLT csoundUndenormalizeFloat |
| 430 |
#else |
| 431 |
# define csoundUndenormalizeMYFLT csoundUndenormalizeDouble |
| 432 |
#endif |
| 433 |
|
| 434 |
#endif |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
# define CS_SPRINTF cs_sprintf |
| 444 |
# define CS_SSCANF cs_sscanf |
| 445 |
|
| 446 |
|
| 447 |
#if !defined(HAVE_STRLCAT) && !defined(strlcat) |
| 448 |
size_t strlcat(char *dst, const char *src, size_t siz); |
| 449 |
#endif |
| 450 |
char *strNcpy(char *dst, const char *src, size_t siz); |
| 451 |
|
| 452 |
|
| 453 |
#if defined(MSVC) |
| 454 |
#define ATOMIC_SET(var, val) InterlockedExchange(&var, val); |
| 455 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 456 |
#define ATOMIC_SET(var, val) __atomic_test_and_set(&var, val); |
| 457 |
#else |
| 458 |
#define ATOMIC_SET(var, val) var = val; |
| 459 |
#endif |
| 460 |
|
| 461 |
#if defined(MSVC) |
| 462 |
#define ATOMIC_SET8(var, val) InterlockedExchange8(&var, val); |
| 463 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 464 |
#define ATOMIC_SET8(var, val) __atomic_test_and_set(&var, val); |
| 465 |
#else |
| 466 |
#define ATOMIC_SET8(var, val) var = val; |
| 467 |
#endif |
| 468 |
|
| 469 |
#ifdef MSVC |
| 470 |
#define ATOMIC_GET(var) InterlockedExchangeAdd(&var, 0) |
| 471 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 472 |
#define ATOMIC_GET(var) __atomic_load_n(&var, __ATOMIC_SEQ_CST) |
| 473 |
#else |
| 474 |
#define ATOMIC_GET(var) var |
| 475 |
#endif |
| 476 |
|
| 477 |
#ifdef MSVC |
| 478 |
#define ATOMIC_GET8(var) InterlockedExchangeAdd8(&var, 0) |
| 479 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 480 |
#define ATOMIC_GET8(var) __atomic_load_n(&var, __ATOMIC_SEQ_CST) |
| 481 |
#else |
| 482 |
#define ATOMIC_GET8(var) var |
| 483 |
#endif |
| 484 |
|
| 485 |
#ifdef MSVC |
| 486 |
#define ATOMIC_DECR(var) InterlockedExchangeAdd(&var, -1) |
| 487 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 488 |
#define ATOMIC_DECR(var) __atomic_sub_fetch(&var, 1, __ATOMIC_SEQ_CST) |
| 489 |
#else |
| 490 |
#define ATOMIC_DECR(var) var -= 1 |
| 491 |
#endif |
| 492 |
|
| 493 |
#ifdef MSVC |
| 494 |
#define ATOMIC_INCR(var) InterlockedExchangeAdd(&var, 1) |
| 495 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 496 |
#define ATOMIC_INCR(var) __atomic_add_fetch(&var, 1, __ATOMIC_SEQ_CST) |
| 497 |
#else |
| 498 |
#define ATOMIC_INCR(var) var += 1 |
| 499 |
#endif |
| 500 |
|
| 501 |
#ifdef MSVC |
| 502 |
#define ATOMIC_SUB(var, val) InterlockedExchangeAdd(&var, -val) |
| 503 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 504 |
#define ATOMIC_SUB(var, val) __atomic_sub_fetch(&var, val, __ATOMIC_SEQ_CST) |
| 505 |
#else |
| 506 |
#define ATOMIC_SUB(var, val) var -= val |
| 507 |
#endif |
| 508 |
|
| 509 |
#ifdef MSVC |
| 510 |
#define ATOMIC_ADD(var, val) InterlockedExchangeAdd(&var, val) |
| 511 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 512 |
#define ATOMIC_ADD(var, val) __atomic_add_fetch(&var, val, __ATOMIC_SEQ_CST) |
| 513 |
#else |
| 514 |
#define ATOMIC_ADD(var, val) var += val |
| 515 |
#endif |
| 516 |
|
| 517 |
#if defined(MSVC) |
| 518 |
#define ATOMIC_CMP_XCH(val, newVal, oldVal) \ |
| 519 |
(InterlockedCompareExchange(val, newVal, oldVal) != oldVal) |
| 520 |
#elif defined(HAVE_ATOMIC_BUILTIN) |
| 521 |
#define ATOMIC_CMP_XCH(val, newVal, oldVal) \ |
| 522 |
!(__atomic_compare_exchange(val, (long *) &oldVal, &newVal, 0, \ |
| 523 |
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) |
| 524 |
#else |
| 525 |
#define ATOMIC_CMP_XCH(val, newVal, oldVal) (*val = newVal) != oldVal |
| 526 |
#endif |
| 527 |
|
| 528 |
#if defined(WIN32) |
| 529 |
typedef int32_t spin_lock_t; |
| 530 |
#define SPINLOCK_INIT 0 |
| 531 |
#elif defined(__GNUC__) && defined(HAVE_PTHREAD_SPIN_LOCK) |
| 532 |
typedef pthread_spinlock_t spin_lock_t; |
| 533 |
#define SPINLOCK_INIT PTHREAD_SPINLOCK_INITIALIZER |
| 534 |
#elif defined(__GNUC__) && defined(HAVE_SYNC_LOCK_TEST_AND_SET) |
| 535 |
typedef int32_t spin_lock_t; |
| 536 |
#define SPINLOCK_INIT 0 |
| 537 |
#elif defined(MACOSX) |
| 538 |
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12 |
| 539 |
#include <os/lock.h> |
| 540 |
typedef struct os_unfair_lock_s spin_lock_t; |
| 541 |
#define SPINLOCK_INIT {0} |
| 542 |
#else |
| 543 |
#include <libkern/OSAtomic.h> |
| 544 |
typedef int32_t spin_lock_t; |
| 545 |
#define SPINLOCK_INIT 0 |
| 546 |
#endif |
| 547 |
#else |
| 548 |
typedef int32_t spin_lock_t; |
| 549 |
#define SPINLOCK_INIT 0 |
| 550 |
#endif |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__) |
| 560 |
# define ignore_value(x) \ |
| 561 |
(__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) |
| 562 |
#else |
| 563 |
# define ignore_value(x) ((void) (x)) |
| 564 |
#endif |
| 565 |
|
| 566 |
|
| 567 |
#endif |