1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
TEXT memset(SB),$0
CLD
MOVQ RARG, DI
MOVBLZX c+8(FP), AX
MOVL n+16(FP), BX
/*
* if not enough bytes, just set bytes
*/
CMPL BX, $9
JLS c3
/*
* if not aligned, just set bytes
*/
MOVQ RARG, CX
ANDL $3,CX
JNE c3
/*
* build word in AX
*/
MOVB AL, AH
MOVL AX, CX
SHLL $16, CX
ORL CX, AX
/*
* set whole longs
*/
c1:
MOVQ BX, CX
SHRQ $2, CX
ANDL $3, BX
REP; STOSL
/*
* set the rest, by bytes
*/
c3:
MOVL BX, CX
REP; STOSB
ret:
MOVQ RARG,AX
RET
|