Imported Upstream version 0.6.27
[platform/upstream/libsolv.git] / src / poolarch.h
index 017f1e6..3fe5f02 100644 (file)
@@ -5,11 +5,43 @@
  * for further information
  */
 
-#ifndef POOLARCH_H
-#define POOLARCH_H
+#ifndef LIBSOLV_POOLARCH_H
+#define LIBSOLV_POOLARCH_H
 
 #include "pool.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern void pool_setarch(Pool *, const char *);
+extern void pool_setarchpolicy(Pool *, const char *);
+extern unsigned char pool_arch2color_slow(Pool *pool, Id arch);
+
+#define ARCHCOLOR_32    1
+#define ARCHCOLOR_64    2
+#define ARCHCOLOR_ALL   255
+
+static inline unsigned char pool_arch2color(Pool *pool, Id arch)
+{
+  if (arch > pool->lastarch)
+    return ARCHCOLOR_ALL;
+  if (pool->id2color && pool->id2color[arch])
+    return pool->id2color[arch];
+  return pool_arch2color_slow(pool, arch);
+}
+
+static inline int pool_colormatch(Pool *pool, Solvable *s1, Solvable *s2)
+{
+  if (s1->arch == s2->arch)
+    return 1;
+  if ((pool_arch2color(pool, s1->arch) & pool_arch2color(pool, s2->arch)) != 0)
+    return 1;
+  return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
 
-#endif /* POOLARCH_H */
+#endif /* LIBSOLV_POOLARCH_H */