On 07/23/2010 02:14 PM, Colin Watson wrote:
> On Fri, Jun 25, 2010 at 08:27:20PM +0200, Vladimir 'φ-coder/phcoder'
> Serbinenko wrote:
>
>>> +void *
>>> +grub_memset (void *s, int c, grub_size_t n)
>>> +{
>>> + unsigned char *p = (unsigned char *) s;
>>> +
>>> + while (n--)
>>> +*p++ = (u
On Fri, Jul 23, 2010 at 10:56:24AM -0500, richardvo...@gmail.com wrote:
> [snip]
>
> > + unsigned long patternl = 0;
> > + grub_size_t i;
> > +
> > + for (i = 0; i < sizeof (unsigned long); i++)
> > + patternl |= ((unsigned long) pattern8) << (8 * i);
> > +
>
> might I sugges
On Fri, Jul 23, 2010 at 2:48 PM, richardvo...@gmail.com <
richardvo...@gmail.com> wrote:
>
>
> On Fri, Jul 23, 2010 at 12:34 PM, Christian Franke <
> christian.fra...@t-online.de> wrote:
>
>> richardvoigt wrote:
>>
>>>
>>> might I suggest:
>>>
>>> unsigned long patternl = pattern8;
>>> patternl |=
On Fri, Jul 23, 2010 at 12:34 PM, Christian Franke <
christian.fra...@t-online.de> wrote:
> richardvoigt wrote:
>
>>
>> might I suggest:
>>
>> unsigned long patternl = pattern8;
>> patternl |= patternl << 8;
>> patternl |= patternl << 16;
>> patternl |= patternl << 32;
>> patternl |= patternl << 6
richardvoigt wrote:
might I suggest:
unsigned long patternl = pattern8;
patternl |= patternl << 8;
patternl |= patternl << 16;
patternl |= patternl << 32;
patternl |= patternl << 64;
O(lg N) instead of O(N), no loop, no branches, and the compiler should
be smart enough to optimize away the la
[snip]
> + unsigned long patternl = 0;
> + grub_size_t i;
> +
> + for (i = 0; i < sizeof (unsigned long); i++)
> + patternl |= ((unsigned long) pattern8) << (8 * i);
> +
>
might I suggest:
unsigned long patternl = pattern8;
patternl |= patternl << 8;
patternl |= patternl <<
On Fri, Jun 25, 2010 at 08:27:20PM +0200, Vladimir 'φ-coder/phcoder' Serbinenko
wrote:
> > +void *
> > +grub_memset (void *s, int c, grub_size_t n)
> > +{
> > + unsigned char *p = (unsigned char *) s;
> > +
> > + while (n--)
> > +*p++ = (unsigned char) c;
> > +
> > + return s;
> > +}
>
> A
>
> +void *
> +grub_memset (void *s, int c, grub_size_t n)
> +{
> + unsigned char *p = (unsigned char *) s;
> +
> + while (n--)
> +*p++ = (unsigned char) c;
> +
> + return s;
> +}
>
Attached is a possible generic implementation. Not even compile-tested.
Could you test it and compare disas
On 06/23/2010 11:38 PM, Colin Watson wrote:
> With this approach, one of the most noticeable time sinks is that
> setting a graphical video mode (I'm using the VBE backend) takes ages:
> 1.6 seconds, which is a substantial percentage of this project's total
> boot time. It turns out that most of t