support -X option in rpmmd2solv, make add_autopattern available in bindings
[platform/upstream/libsolv.git] / src / poolarch.h
1 /*
2  * Copyright (c) 2007, Novell Inc.
3  *
4  * This program is licensed under the BSD license, read LICENSE.BSD
5  * for further information
6  */
7
8 #ifndef LIBSOLV_POOLARCH_H
9 #define LIBSOLV_POOLARCH_H
10
11 #include "pool.h"
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 extern void pool_setarch(Pool *, const char *);
18 extern void pool_setarchpolicy(Pool *, const char *);
19 extern unsigned char pool_arch2color_slow(Pool *pool, Id arch);
20
21 #define ARCHCOLOR_32    1
22 #define ARCHCOLOR_64    2
23 #define ARCHCOLOR_ALL   255
24
25 static inline unsigned char pool_arch2color(Pool *pool, Id arch)
26 {
27   if (arch > pool->lastarch)
28     return ARCHCOLOR_ALL;
29   if (pool->id2color && pool->id2color[arch])
30     return pool->id2color[arch];
31   return pool_arch2color_slow(pool, arch);
32 }
33
34 static inline int pool_colormatch(Pool *pool, Solvable *s1, Solvable *s2)
35 {
36   if (s1->arch == s2->arch)
37     return 1;
38   if ((pool_arch2color(pool, s1->arch) & pool_arch2color(pool, s2->arch)) != 0)
39     return 1;
40   return 0;
41 }
42
43 #ifdef __cplusplus
44 }
45 #endif
46
47 #endif /* LIBSOLV_POOLARCH_H */