linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michał Nazarewicz" <m.nazarewicz@samsung.com>
To: Holger Kiehl <Holger.Kiehl@dwd.de>, linux-c-programming@vger.kernel.org
Subject: Re: How to use CRC32 of SSE 4.2 on i3/5/7?
Date: Mon, 08 Feb 2010 13:15:04 +0100	[thread overview]
Message-ID: <op.u7s5nenr7p4s8u@pikus> (raw)
In-Reply-To: <alpine.LRH.2.00.1002081130110.11287@praktifix.dwd.de>

On Mon, 08 Feb 2010 12:41:04 +0100, Holger Kiehl <Holger.Kiehl@dwd.de> wrote:
> In my application I use a lot of crc32 checksum calculation in a little
> C function. I now have access to a system with an i7 which does have
> crc32 as an instruction. How can I make use of this instruction in
> my program? Most likely one can do this directly via assembler code, but
> is there support for this via libc?

This is doubtful however you might try using OpenSSL or similar library
(IIRC it has CRC32 function implemented) and hope it has optimization
for architecture you are running which may or may not be the case
depending on how it has been compiled.

This is probably the most portable way (as portable as the library) of
achieving optimized CRC32 calculation meaning that you may get different
optimizations on different architectures depending and you won't have
to worry about it but at the same time you may end up with generic code.

If you don't care about portability that much and simply won't to have
fast function on your machine I'd say your best bet is using (inline)
assembly (if you're using GCC google for "GCC inline assembly" or look
through GCC's info pages).

-- 
Best regards,                                           _     _
  .o. | Liege of Serenely Enlightened Majesty of       o' \,=./ `o
  ..o | Computer Science,  Michał "mina86" Nazarewicz     (o o)
  ooo +---[mina86@mina86.com]---[mina86@jabber.org]---ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2010-02-08 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08 11:41 How to use CRC32 of SSE 4.2 on i3/5/7? Holger Kiehl
2010-02-08 12:15 ` Michał Nazarewicz [this message]

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=op.u7s5nenr7p4s8u@pikus \
    --to=m.nazarewicz@samsung.com \
    --cc=Holger.Kiehl@dwd.de \
    --cc=linux-c-programming@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).