loader: Build the preloader for ARM
Peter Rosin
peda at lysator.liu.se
Fri Feb 4 13:43:09 CST 2011
Den 2011-02-04 20:36 skrev Peter Rosin:
> Den 2011-02-04 17:41 skrev André Hentschel:
>> % and / both lead to external dependencies here...
>> maybe the euclidean algorithm helps, because -Os would need ugly changes to configure i guess.
>>
>
> Finding gcd is a bit over the top...
>
> How about something like the following?
>
> Cheers,
> Peter
>
> unsigned int wld_modulo( const unsigned int a, const Elf32_Word b )
> {
> #ifdef __ARM_EABI__
> unsigned int r = 0;
> int i;
>
> for (i = sizeof(a) * 8 - 1; i >= 0; --i) {
> r <<= 1;
> if (a & (1U << i))
> r |= 1;
> if (r > b)
Ooops, bug. Should be "if (r >= b)"
> r -= b;
> }
>
> return r;
> ...
>
>
Cheers,
Peter
More information about the wine-devel
mailing list