github.com/primecitizens/pcz/std@v0.2.1/core/mem/clear_plan9_amd64.s (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2014 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build pcz && amd64 && plan9
     9  
    10  #include "textflag.h"
    11  
    12  // See memclrNoHeapPointers Go doc for important implementation constraints.
    13  
    14  // func Clear(ptr unsafe.Pointer, n uintptr)
    15  TEXT ·Clear(SB),NOSPLIT,$0-16
    16  	MOVQ ptr+0(FP), DI
    17  	MOVQ n+8(FP), CX
    18  	MOVQ CX, BX
    19  	ANDQ $7, BX
    20  	SHRQ $3, CX
    21  	MOVQ $0, AX
    22  	CLD
    23  	REP
    24  	STOSQ
    25  	MOVQ BX, CX
    26  	REP
    27  	STOSB
    28  	RET