grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Optimise memset on i386


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] Optimise memset on i386
Date: Fri, 25 Jun 2010 20:27:20 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100515 Icedove/3.0.4

>
> +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 disasm of this version on i386 and glibc
i386 version. Perhaps they are equivalent. If they are for maintainance
reasons it's better to always use generic one.
> +
> +#ifndef APPLE_CC
> +void *memset (void *s, int c, grub_size_t n)
> +  __attribute__ ((alias ("grub_memset")));
> +#else
> +void *memset (void *s, int c, grub_size_t n)
> +{
> +  return grub_memset (s, c, n);
> +}
> +#endif
>
> Thanks,
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

Attachment: memset.c
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]