eal: move common header files
[dpdk.git] / lib / librte_eal / windows / eal / include / sched.h
index 29868c9..fbe07f7 100644 (file)
@@ -39,6 +39,52 @@ typedef struct _rte_cpuset_s {
                        (s)->_bits[_i] = 0LL;                           \
        } while (0)
 
+#define CPU_ISSET(b, s) (((s)->_bits[_WHICH_SET(b)] & \
+       (1LL << _WHICH_BIT(b))) != 0LL)
+
+static inline int
+count_cpu(rte_cpuset_t *s)
+{
+       unsigned int _i;
+       int count = 0;
+
+       for (_i = 0; _i < _NUM_SETS(CPU_SETSIZE); _i++)
+               if (CPU_ISSET(_i, s) != 0LL)
+                       count++;
+       return count;
+}
+#define CPU_COUNT(s) count_cpu(s)
+
+#define CPU_AND(dst, src1, src2) \
+do { \
+       unsigned int _i; \
+       \
+       for (_i = 0; _i < _NUM_SETS(CPU_SETSIZE); _i++) \
+               (dst)->_bits[_i] = (src1)->_bits[_i] & (src2)->_bits[_i]; \
+} while (0)
+
+#define CPU_OR(dst, src1, src2) \
+do { \
+       unsigned int _i; \
+       \
+       for (_i = 0; _i < _NUM_SETS(CPU_SETSIZE); _i++) \
+               (dst)->_bits[_i] = (src1)->_bits[_i] | (src2)->_bits[_i]; \
+} while (0)
+
+#define CPU_FILL(s) \
+do { \
+       unsigned int _i; \
+       for (_i = 0; _i < _NUM_SETS(CPU_SETSIZE); _i++) \
+               (s)->_bits[_i] = -1LL; \
+} while (0)
+
+#define CPU_NOT(dst, src) \
+do { \
+       unsigned int _i; \
+       for (_i = 0; _i < _NUM_SETS(CPU_SETSIZE); _i++) \
+               (dst)->_bits[_i] = (src)->_bits[_i] ^ -1LL; \
+} while (0)
+
 #ifdef __cplusplus
 }
 #endif