Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1 | #ifndef ARCH_H |
| 2 | #define ARCH_H |
| 3 | |
| 4 | enum { |
| 5 | arch_x86_64, |
| 6 | arch_i386, |
| 7 | arch_ppc, |
| 8 | arch_ia64, |
| 9 | arch_s390, |
| 10 | arch_alpha, |
| 11 | }; |
| 12 | |
| 13 | static inline unsigned long generic_ffz(unsigned long word) |
| 14 | { |
| 15 | unsigned int i; |
| 16 | |
| 17 | for (i = 0; i < sizeof(word) * 8; i++) |
| 18 | if ((word & (1UL << i)) == 0) |
| 19 | return i; |
| 20 | |
| 21 | return -1; |
| 22 | } |
| 23 | |
| 24 | #if defined(__i386__) |
| 25 | #include "arch-x86.h" |
| 26 | #elif defined(__x86_64__) |
| 27 | #include "arch-x86_64.h" |
| 28 | #elif defined(__powerpc__) || defined(__powerpc64__) |
| 29 | #include "arch-ppc.h" |
| 30 | #elif defined(__ia64__) |
| 31 | #include "arch-ia64.h" |
| 32 | #elif defined(__alpha__) |
| 33 | #include "arch-alpha.h" |
| 34 | #elif defined(__s390x__) || defined(__s390__) |
| 35 | #include "arch-s390.h" |
| 36 | #else |
| 37 | #error "Unsupported arch" |
| 38 | #endif |
| 39 | |
| 40 | #define BITS_PER_LONG (__WORDSIZE) |
| 41 | |
| 42 | #endif |