found the answer with the help of author os repo,
disassemble the code, fast use XORQ, the safe one use XORL but actually xor
byte by byte.
the fast convert the oprand to uintptr. so it can use XOR 4/8 byte one time
在 2019年3月19日星期二 UTC+8上午10:36:21,zhou yu写道:
>
> *Why the XOR between*(*[]u
then work through
> what it is doing, then compare that with the original alternatives.
>
> Michael
>
> On Mon, Mar 18, 2019 at 9:58 PM Michael Jones > wrote:
>
>> n%8 is not what you want.
>>
>> n - n%8 is what you want, best expressed as n &^0x7
>&g
al.
>
> See https://github.com/golang/go/issues/21496
>
> On Mon, 2019-03-18 at 20:01 -0700, zhou yu wrote:
> > gc can not infer the type of {1, 2} of {1,2,3,4}, so you need to
> > indicate
> > it's type
>
--
You received this message because you are subscr
gc can not infer the type of {1, 2} of {1,2,3,4}, so you need to indicate
it's type
在 2019年3月19日星期二 UTC+8上午10:47:43,dja...@gmail.com写道:
>
> Hi,
> https://play.golang.org/p/hRHEuGG6zAf
> why composite literal in line 16 does not work ?
> thanks in advance.
>
--
You received this message because
*Why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then
[]byte?*
I find a fast xor lib https://github.com/templexxx/xor, and write the
benchmark below,
the result show that BenchmarkFastXORWords is 5x faster than BenchmarkS
afeXORBytes on my computer
I can't figure out why? Anyon