github.com/goshafaq/sonic@v0.0.0-20231026082336-871835fb94c6/ast/stubs_go120.go (about)

     1  //go:build go1.20
     2  // +build go1.20
     3  
     4  /*
     5   * Copyright 2021 ByteDance Inc.
     6   *
     7   * Licensed under the Apache License, Version 2.0 (the "License");
     8   * you may not use this file except in compliance with the License.
     9   * You may obtain a copy of the License at
    10   *
    11   *     http://www.apache.org/licenses/LICENSE-2.0
    12   *
    13   * Unless required by applicable law or agreed to in writing, software
    14   * distributed under the License is distributed on an "AS IS" BASIS,
    15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16   * See the License for the specific language governing permissions and
    17   * limitations under the License.
    18   */
    19  
    20  package ast
    21  
    22  import (
    23  	"unicode/utf8"
    24  	"unsafe"
    25  
    26  	"github.com/goshafaq/sonic/internal/rt"
    27  )
    28  
    29  //go:noescape
    30  //go:linkname memmove runtime.memmove
    31  //goland:noinspection GoUnusedParameter
    32  func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr)
    33  
    34  //go:linkname unsafe_NewArray reflect.unsafe_NewArray
    35  //goland:noinspection GoUnusedParameter
    36  func unsafe_NewArray(typ *rt.GoType, n int) unsafe.Pointer
    37  
    38  //go:linkname growslice reflect.growslice
    39  //goland:noinspection GoUnusedParameter
    40  func growslice(et *rt.GoType, old rt.GoSlice, cap int) rt.GoSlice
    41  
    42  //go:nosplit
    43  func mem2ptr(s []byte) unsafe.Pointer {
    44  	return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr
    45  }
    46  
    47  var (
    48  	//go:linkname safeSet encoding/json.safeSet
    49  	safeSet [utf8.RuneSelf]bool
    50  
    51  	//go:linkname hex encoding/json.hex
    52  	hex string
    53  )
    54  
    55  //go:linkname unquoteBytes encoding/json.unquoteBytes
    56  func unquoteBytes(s []byte) (t []byte, ok bool)