Re: [HACKERS] [PATCH v2] Add bit operations util header

2009-06-03 Thread Jeremy Kerr
Hi Tom, > The other thing I didn't like about the patch was the assumption that > it's okay to have a "static inline" function in a header. You can > get away with that in gcc but *not* in other compilers. Gee, you user-space guys have it tough! :D Point taken, will rework. > Look at the exist

Re: [HACKERS] [PATCH v2] Add bit operations util header

2009-06-03 Thread Tom Lane
Florian Weimer writes: > * Jeremy Kerr: >> Because now we have to test the compiler *and* the version as well? > This builtin is not architecture-specific, so you'd save the > architecture check. The appropriate way to handle it would be a configure probe to see if the function is available, thu

Re: [HACKERS] [PATCH v2] Add bit operations util header

2009-06-03 Thread Florian Weimer
* Jeremy Kerr: > Florian, > >> > +#if defined(__GNUC__) && \ >> > + (defined(__ppc__) || defined(__powerpc__) || \ >> > + defined(__ppc64__) || defined (__powerpc64__)) >> >> If you require GCC anyway, you can use __builtin_clz instead. >> (It's been available since GCC 4.1 at least.) > > Becau

Re: [HACKERS] [PATCH v2] Add bit operations util header

2009-06-03 Thread Jeremy Kerr
Florian, > > +#if defined(__GNUC__) && \ > > + (defined(__ppc__) || defined(__powerpc__) || \ > > +defined(__ppc64__) || defined (__powerpc64__)) > > If you require GCC anyway, you can use __builtin_clz instead. > (It's been available since GCC 4.1 at least.) Because now we have to test the

Re: [HACKERS] [PATCH v2] Add bit operations util header

2009-06-03 Thread Florian Weimer
* Jeremy Kerr: > +#if defined(__GNUC__) && \ > + (defined(__ppc__) || defined(__powerpc__) || \ > + defined(__ppc64__) || defined (__powerpc64__)) If you require GCC anyway, you can use __builtin_clz instead. (It's been available since GCC 4.1 at least.) -- Florian Weimer

[HACKERS] [PATCH v2] Add bit operations util header

2009-06-02 Thread Jeremy Kerr
Add a utility header for simple bit operatios - bitops.h. At present, just contains the fls() (find last set bit) function. Signed-off-by: Jeremy Kerr --- v2: only use inline asm with gcc --- src/include/utils/bitops.h | 53 + 1 file changed, 53 i