> +++ b/platform/linux-generic/include/odp_bitset.h
> @@ -0,0 +1,210 @@
> +/* Copyright (c) 2017, ARM Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#ifndef _ODP_BITSET_H_
> +#define _ODP_BITSET_H_
> +
> +#include <odp_cpu.h>
> +
> +#include <limits.h>
> +
> +/************************************************************************
> ******
> + * bitset abstract data type
> +
> **************************************************************************
> ***/
> +/* This could be a struct of scalars to support larger bit sets */
> +
> +/*
> + * Size of atomic bit set. This limits the max number of threads,
> + * scheduler groups and reorder windows. On ARMv8/64-bit and x86-64, the
> + * (lock-free) max is 128
> + */
> +
> +/* Find a suitable data type that supports lock-free atomic operations */
> +#if defined(__ARM_ARCH) &&  __ARM_ARCH == 8 &&  __ARM_64BIT_STATE == 1 &&

Why ifdef ARM? Why this code is not in arch directory ?

-Petri


> \
> +     defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ == 16
> +#define LOCKFREE16
> +typedef __int128 bitset_t;
> +#define ATOM_BITSET_SIZE (CHAR_BIT * __SIZEOF_INT128__)
> +
> +#elif __GCC_ATOMIC_LLONG_LOCK_FREE == 2 && \
> +     __SIZEOF_LONG_LONG__ != __SIZEOF_LONG__
> +typedef unsigned long long bitset_t;
> +#define ATOM_BITSET_SIZE (CHAR_BIT * __SIZEOF_LONG_LONG__)
> +
> +#elif __GCC_ATOMIC_LONG_LOCK_FREE == 2 && __SIZEOF_LONG__ !=
> __SIZEOF_INT__
> +typedef unsigned long bitset_t;
> +#define ATOM_BITSET_SIZE (CHAR_BIT * __SIZEOF_LONG__)
> +
> +#elif __GCC_ATOMIC_INT_LOCK_FREE == 2
> +typedef unsigned int bitset_t;
> +#define ATOM_BITSET_SIZE (CHAR_BIT * __SIZEOF_INT__)
> +
> +#else
> +/* Target does not support lock-free atomic operations */
> +typedef unsigned int bitset_t;
> +#define ATOM_BITSET_SIZE (CHAR_BIT * __SIZEOF_INT__)
> +#endif
> +
> +#if ATOM_BITSET_SIZE <= 32


Reply via email to