]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - compat/cpu.h
SourceFormat Enforcement
[thirdparty/squid.git] / compat / cpu.h
index 9e58847b82ea197843c5c6f5da16a33edda7ebe9..5579a76e4a8748028c8534060aad94996bd7348c 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * $Id$
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
-#ifndef SQUID_CONFIG_H
-#include "config.h"
-#endif
-
 #ifndef SQUID_COMPAT_CPU_H
 #define SQUID_COMPAT_CPU_H
 
@@ -38,10 +38,11 @@ CpuCount(const cpu_set_t *set)
 inline void
 CpuAnd(cpu_set_t *destset, const cpu_set_t *srcset1, const cpu_set_t *srcset2)
 {
-    CPU_ZERO(destset);
     for (int i = 0; i < CPU_SETSIZE; ++i) {
         if (CPU_ISSET(i, srcset1) && CPU_ISSET(i, srcset2))
             CPU_SET(i, destset);
+        else
+            CPU_CLR(i, destset);
     }
 }
 #endif /* CPU_AND */
@@ -61,9 +62,11 @@ typedef struct {
 #define CPU_AND(destset, srcset1, srcset2) (void)0
 #define CPU_ZERO(set) (void)0
 #define CPU_SET(cpu, set) (void)0
+#define CPU_CLR(cpu, set) (void)0
 inline int sched_setaffinity(int, size_t, cpu_set_t *) { return ENOTSUP; }
 inline int sched_getaffinity(int, size_t, cpu_set_t *) { return ENOTSUP; }
 
 #endif /* HAVE_CPU_AFFINITY */
 
 #endif /* SQUID_COMPAT_CPU_H */
+