...

Source file src/github.com/chenzhuoyu/base64x/native_amd64.go

Documentation: github.com/chenzhuoyu/base64x

     1  //go:generate make
     2  package base64x
     3  
     4  import (
     5      `unsafe`
     6  
     7      `github.com/bytedance/sonic/loader`
     8  )
     9  
    10  //go:nosplit
    11  func b64encode(out *[]byte, src *[]byte, mode int) {
    12      __b64encode(noEscape(unsafe.Pointer(out)), noEscape(unsafe.Pointer(src)), mode)
    13  }
    14  
    15  //go:nosplit
    16  func b64decode(out *[]byte, src unsafe.Pointer, len int, mode int) (ret int) {
    17      return __b64decode(noEscape(unsafe.Pointer(out)), noEscape(unsafe.Pointer(src)), len, mode)
    18  }
    19  
    20  // asm2asm templates
    21  var (
    22      __b64encode func(out unsafe.Pointer, src unsafe.Pointer, mod int)
    23      __b64decode func(out unsafe.Pointer, src unsafe.Pointer, len int, mod int) (ret int)
    24  )
    25  
    26  // directly jump PCs
    27  var (
    28      _subr__b64encode uintptr
    29      _subr__b64decode uintptr
    30  )
    31  
    32  var stubs = []loader.GoC{
    33      {"_b64encode", &_subr__b64encode, &__b64encode},
    34      {"_b64decode", &_subr__b64decode, &__b64decode},
    35  }
    36  
    37  func init() {
    38      if hasAVX2() {
    39          archFlags = _MODE_AVX2
    40      }
    41      loader.WrapGoC(text__native_entry__, funcs, stubs, "base64x", "base64x/native.c")
    42  }
    43  

View as plain text