On Sun, 2008-07-20 at 15:45 +0200, Christian Franke wrote: > Christian Franke wrote:
> > But the function call in the 32-bit case requires only 5 bytes :-) > > > > Sorry, I was wrong here. The assumption about function call size was > only true for module-local calls. If a module calls a function in > kernel, each 5 byte call requires another 8 bytes for the ELF relocation > table entry. Actually, the new versions of gcc have __builtin_bswap32 and __builtin_bswap64, which are optimized even better. There is no __builtin_bswap16 because it is said that any correct implementation will be optimized anyway: http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00079.html gcc 4.3.0 from Fedora is working fine with them. I'm not sure about gcc 4.2. There is only one bug. Suppose I use this: #define grub_swap_bytes32(x) __builtin_bswap32(x) #define grub_swap_bytes64(x) __builtin_bswap64(x) Then I get this warning: partmap/apple.c: In function 'apple_partition_map_iterate': partmap/apple.c:133: warning: format '%x' expects type 'unsigned int', but argument 8 has type 'unsigned int' partmap/apple.c:133: warning: format '%x' expects type 'unsigned int', but argument 9 has type 'unsigned int' Those arguments are produced by grub_swap_bytes32(). But if I use wrapper functions, then there are no warnings, and the code side is approximately the same. We'll need wrappers to support sparse. -- Regards, Pavel Roskin _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel