From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] lib:crc32: Allow setting of the initial crc32 value
Date: Wed, 07 May 2014 12:17:26 +0200 [thread overview]
Message-ID: <20140507121726.509de3a2@amdc2363> (raw)
In-Reply-To: <201405071025.52611.marex@denx.de>
Hi Marek,
> On Wednesday, May 07, 2014 at 08:10:20 AM, Lukasz Majewski wrote:
>
> [...]
>
> > --- a/lib/crc32.c
> > +++ b/lib/crc32.c
> > @@ -255,9 +255,12 @@ uint32_t ZEXPORT crc32_wd (uint32_t crc,
> > void crc32_wd_buf(const unsigned char *input, unsigned int ilen,
> > unsigned char *output, unsigned int chunk_sz)
> > {
> > - uint32_t crc;
> > + uint32_t crc = 0;
> >
> > - crc = crc32_wd(0, input, ilen, chunk_sz);
> > + if (*output)
> > + memcpy(&crc, output, sizeof(crc));
>
> Won't some sort of put_unaligned() work here ? The $crc is uint32_t
> afterall, so it might be a jiff faster.
We are concerned here with the use case of copying 4 bytes from
unaligned buffer defined on some architectures.
I suppose, that the performance would be the same for both.
However, since memcpy() is already used in this function, I would
prefer to use it here.
> Please correct me if I'm
> wrong.
>
> > +
> > + crc = crc32_wd(crc, input, ilen, chunk_sz);
> > crc = htonl(crc);
> > memcpy(output, &crc, sizeof(crc));
> > }
>
> Best regards,
> Marek Vasut
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
next prev parent reply other threads:[~2014-05-07 10:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 13:07 [U-Boot] [PATCH] lib:crc32: Allow setting of the initial crc32 value Lukasz Majewski
2014-05-05 17:47 ` Wolfgang Denk
2014-05-05 18:56 ` Marek Vasut
2014-05-06 5:54 ` Lukasz Majewski
2014-05-05 17:51 ` Marek Vasut
2014-05-07 6:10 ` [U-Boot] [PATCH v2] " Lukasz Majewski
2014-05-07 8:25 ` Marek Vasut
2014-05-07 10:17 ` Lukasz Majewski [this message]
2014-05-07 10:42 ` Wolfgang Denk
2014-05-07 12:25 ` Lukasz Majewski
2014-05-07 12:57 ` [U-Boot] [PATCH v3] lib:crc32:hash: " Lukasz Majewski
2014-05-07 23:04 ` Simon Glass
2014-05-08 8:59 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140507121726.509de3a2@amdc2363 \
--to=l.majewski@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.