On 05/03/2014 11:26 AM, Jessica Hamilton wrote:
In ticket #10800, initially I thought problems with the byteswap implementations was related to calling conventions, however, digging deeper and after some clarification by tqh, it's obviously not the case. It was also suggested to use GCC builtins to replace the existing byteswap functions, and I have the beginnings of a patch: https://dev.haiku-os.org/attachment/ticket/10800/0001-Replace-arch-dependent-integer-byteswap-routines-wit.patch Is this the right place to do this?
Yep, looks good. I'd also replace the implementation of the __swap_int*() by a call the the respective built-in (i.e. replace the per-arch assembly implementation by a generic one). We can eventually even drop the non-gcc 2 ones.
I guess the float and double versions can be mapped to the int versions as well with some casting.
Is it sufficient to assume this will be okay on all our platforms, or do we still want the builtins abstracted? If so, can that be done without losing the ability to
> inline them?I don't think we need an abstraction. Only for BeOS binary compatibility we the function definitions. At least according to the gcc 4.8.2 documentation [1], the built-ins are available on all architectures. At a first glance, gcc 2.95.3 doesn't seem to provide them, though [2].
CU, Ingo[1] http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Other-Builtins.html#Other-Builtins
[2] http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC61