[PATCH] flashcp: improve speed & some clean ups
Mike Frysinger
vapier.adi at gmail.com
Thu Apr 7 11:45:19 EDT 2011
On Thu, Apr 7, 2011 at 11:38, Leon Woestenberg wrote:
> On Thu, Apr 7, 2011 at 5:04 PM, Frans Meulenbroeks wrote:
>> +static int compare(unsigned char *src, unsigned char *dst, ssize_t len)
>> +{
>> + int rv = 0;
>> + unsigned long long *sp = (unsigned long long *)src;
>> + unsigned long long *dp = (unsigned long long *)dst;
>> +
>
> Dangerous on platforms that do not support non-natural alignments (ARM is one).
>
> Unless the alignment rules are enforced elsewhere?
i dont think they are. looking at this code though, seems like it
could be solved without needing to use 64/128 bit types and ugly
casts. i feel like it could be done with a clever memcmp or memchr or
memmem.
-mike
More information about the linux-mtd
mailing list