1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-09 03:37:37 -05:00
v2fly/transport/internet/kcp/xor_amd64.s

48 lines
696 B
ArmAsm
Raw Normal View History

#include "textflag.h"
// func xorfwd(x []byte)
TEXT ·xorfwd(SB),NOSPLIT,$0
MOVQ x+0(FP), SI // x[i]
MOVL x+8(FP), CX // x.len
MOVQ x+0(FP), DI
ADDQ $4, DI // x[i+4]
SUBQ $4, CX
loop:
MOVL (SI), AX
XORL AX, (DI)
ADDQ $4, SI
ADDQ $4, DI
SUBQ $4, CX
CMPL CX, $0
JE done
JMP loop
done:
RET
// func xorbkd(x []byte)
TEXT ·xorbkd(SB),NOSPLIT,$0
MOVQ x+0(FP), SI
MOVL x+8(FP), CX // x.len
MOVQ x+0(FP), DI
ADDQ CX, SI // x[-8]
SUBQ $8, SI
ADDQ CX, DI // x[-4]
SUBQ $4, DI
SUBQ $4, CX
loop:
MOVL (SI), AX
XORL AX, (DI)
SUBQ $4, SI
SUBQ $4, DI
SUBQ $4, CX
CMPL CX, $0
JE done
JMP loop
done:
RET