On Tue, 19 Mar 2019 at 07:32, Michael Jones <michael.jo...@gmail.com> wrote:

> Ok, at my computer now so time for a longer answer.
>
> What you want is this:
> https://play.golang.org/p/QirBtj523Wu
>

I think that's wrong too, as the byte slices might not be word aligned, so
on some architectures, that code will panic due to unaligned access. To do
it right, you'd need to do the word arithmetic only on the aligned parts of
the slice (and only if all the slices are equally aligned), and use
bytewise arithmetic on the unaligned
start and end bytes.

The original also used loop unrolling which could speed things up quite a
bit, but adds complexity. Using uintptr rather than uint64 is likewise
probably faster on non-64-bit architectures.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to