parent
1f3831a39c
commit
b4cf941dd9
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -0,0 +1,14 @@
|
||||
# filippo.io/edwards25519
|
||||
|
||||
```
|
||||
import "filippo.io/edwards25519"
|
||||
```
|
||||
|
||||
This library implements the edwards25519 elliptic curve, exposing the necessary APIs to build a wide array of higher-level primitives.
|
||||
Read the docs at [pkg.go.dev/filippo.io/edwards25519](https://pkg.go.dev/filippo.io/edwards25519).
|
||||
|
||||
The code is originally derived from Adam Langley's internal implementation in the Go standard library, and includes George Tankersley's [performance improvements](https://golang.org/cl/71950). It was then further developed by Henry de Valence for use in ristretto255, and was finally [merged back into the Go standard library](https://golang.org/cl/276272) as of Go 1.17. It now tracks the upstream codebase and extends it with additional functionality.
|
||||
|
||||
Most users don't need this package, and should instead use `crypto/ed25519` for signatures, `golang.org/x/crypto/curve25519` for Diffie-Hellman, or `github.com/gtank/ristretto255` for prime order group logic. However, for anyone currently using a fork of `crypto/internal/edwards25519`/`crypto/ed25519/internal/edwards25519` or `github.com/agl/edwards25519`, this package should be a safer, faster, and more powerful alternative.
|
||||
|
||||
Since this package is meant to curb proliferation of edwards25519 implementations in the Go ecosystem, it welcomes requests for new APIs or reviewable performance improvements.
|
@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package edwards25519 implements group logic for the twisted Edwards curve
|
||||
//
|
||||
// -x^2 + y^2 = 1 + -(121665/121666)*x^2*y^2
|
||||
//
|
||||
// This is better known as the Edwards curve equivalent to Curve25519, and is
|
||||
// the curve used by the Ed25519 signature scheme.
|
||||
//
|
||||
// Most users don't need this package, and should instead use crypto/ed25519 for
|
||||
// signatures, golang.org/x/crypto/curve25519 for Diffie-Hellman, or
|
||||
// github.com/gtank/ristretto255 for prime order group logic.
|
||||
//
|
||||
// However, developers who do need to interact with low-level edwards25519
|
||||
// operations can use this package, which is an extended version of
|
||||
// crypto/internal/edwards25519 from the standard library repackaged as
|
||||
// an importable module.
|
||||
package edwards25519
|
@ -0,0 +1,427 @@
|
||||
// Copyright (c) 2017 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package edwards25519
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"filippo.io/edwards25519/field"
|
||||
)
|
||||
|
||||
// Point types.
|
||||
|
||||
type projP1xP1 struct {
|
||||
X, Y, Z, T field.Element
|
||||
}
|
||||
|
||||
type projP2 struct {
|
||||
X, Y, Z field.Element
|
||||
}
|
||||
|
||||
// Point represents a point on the edwards25519 curve.
|
||||
//
|
||||
// This type works similarly to math/big.Int, and all arguments and receivers
|
||||
// are allowed to alias.
|
||||
//
|
||||
// The zero value is NOT valid, and it may be used only as a receiver.
|
||||
type Point struct {
|
||||
// Make the type not comparable (i.e. used with == or as a map key), as
|
||||
// equivalent points can be represented by different Go values.
|
||||
_ incomparable
|
||||
|
||||
// The point is internally represented in extended coordinates (X, Y, Z, T)
|
||||
// where x = X/Z, y = Y/Z, and xy = T/Z per https://eprint.iacr.org/2008/522.
|
||||
x, y, z, t field.Element
|
||||
}
|
||||
|
||||
type incomparable [0]func()
|
||||
|
||||
func checkInitialized(points ...*Point) {
|
||||
for _, p := range points {
|
||||
if p.x == (field.Element{}) && p.y == (field.Element{}) {
|
||||
panic("edwards25519: use of uninitialized Point")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type projCached struct {
|
||||
YplusX, YminusX, Z, T2d field.Element
|
||||
}
|
||||
|
||||
type affineCached struct {
|
||||
YplusX, YminusX, T2d field.Element
|
||||
}
|
||||
|
||||
// Constructors.
|
||||
|
||||
func (v *projP2) Zero() *projP2 {
|
||||
v.X.Zero()
|
||||
v.Y.One()
|
||||
v.Z.One()
|
||||
return v
|
||||
}
|
||||
|
||||
// identity is the point at infinity.
|
||||
var identity, _ = new(Point).SetBytes([]byte{
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
|
||||
|
||||
// NewIdentityPoint returns a new Point set to the identity.
|
||||
func NewIdentityPoint() *Point {
|
||||
return new(Point).Set(identity)
|
||||
}
|
||||
|
||||
// generator is the canonical curve basepoint. See TestGenerator for the
|
||||
// correspondence of this encoding with the values in RFC 8032.
|
||||
var generator, _ = new(Point).SetBytes([]byte{
|
||||
0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
|
||||
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66})
|
||||
|
||||
// NewGeneratorPoint returns a new Point set to the canonical generator.
|
||||
func NewGeneratorPoint() *Point {
|
||||
return new(Point).Set(generator)
|
||||
}
|
||||
|
||||
func (v *projCached) Zero() *projCached {
|
||||
v.YplusX.One()
|
||||
v.YminusX.One()
|
||||
v.Z.One()
|
||||
v.T2d.Zero()
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *affineCached) Zero() *affineCached {
|
||||
v.YplusX.One()
|
||||
v.YminusX.One()
|
||||
v.T2d.Zero()
|
||||
return v
|
||||
}
|
||||
|
||||
// Assignments.
|
||||
|
||||
// Set sets v = u, and returns v.
|
||||
func (v *Point) Set(u *Point) *Point {
|
||||
*v = *u
|
||||
return v
|
||||
}
|
||||
|
||||
// Encoding.
|
||||
|
||||
// Bytes returns the canonical 32-byte encoding of v, according to RFC 8032,
|
||||
// Section 5.1.2.
|
||||
func (v *Point) Bytes() []byte {
|
||||
// This function is outlined to make the allocations inline in the caller
|
||||
// rather than happen on the heap.
|
||||
var buf [32]byte
|
||||
return v.bytes(&buf)
|
||||
}
|
||||
|
||||
func (v *Point) bytes(buf *[32]byte) []byte {
|
||||
checkInitialized(v)
|
||||
|
||||
var zInv, x, y field.Element
|
||||
zInv.Invert(&v.z) // zInv = 1 / Z
|
||||
x.Multiply(&v.x, &zInv) // x = X / Z
|
||||
y.Multiply(&v.y, &zInv) // y = Y / Z
|
||||
|
||||
out := copyFieldElement(buf, &y)
|
||||
out[31] |= byte(x.IsNegative() << 7)
|
||||
return out
|
||||
}
|
||||
|
||||
var feOne = new(field.Element).One()
|
||||
|
||||
// SetBytes sets v = x, where x is a 32-byte encoding of v. If x does not
|
||||
// represent a valid point on the curve, SetBytes returns nil and an error and
|
||||
// the receiver is unchanged. Otherwise, SetBytes returns v.
|
||||
//
|
||||
// Note that SetBytes accepts all non-canonical encodings of valid points.
|
||||
// That is, it follows decoding rules that match most implementations in
|
||||
// the ecosystem rather than RFC 8032.
|
||||
func (v *Point) SetBytes(x []byte) (*Point, error) {
|
||||
// Specifically, the non-canonical encodings that are accepted are
|
||||
// 1) the ones where the field element is not reduced (see the
|
||||
// (*field.Element).SetBytes docs) and
|
||||
// 2) the ones where the x-coordinate is zero and the sign bit is set.
|
||||
//
|
||||
// Read more at https://hdevalence.ca/blog/2020-10-04-its-25519am,
|
||||
// specifically the "Canonical A, R" section.
|
||||
|
||||
y, err := new(field.Element).SetBytes(x)
|
||||
if err != nil {
|
||||
return nil, errors.New("edwards25519: invalid point encoding length")
|
||||
}
|
||||
|
||||
// -x² + y² = 1 + dx²y²
|
||||
// x² + dx²y² = x²(dy² + 1) = y² - 1
|
||||
// x² = (y² - 1) / (dy² + 1)
|
||||
|
||||
// u = y² - 1
|
||||
y2 := new(field.Element).Square(y)
|
||||
u := new(field.Element).Subtract(y2, feOne)
|
||||
|
||||
// v = dy² + 1
|
||||
vv := new(field.Element).Multiply(y2, d)
|
||||
vv = vv.Add(vv, feOne)
|
||||
|
||||
// x = +√(u/v)
|
||||
xx, wasSquare := new(field.Element).SqrtRatio(u, vv)
|
||||
if wasSquare == 0 {
|
||||
return nil, errors.New("edwards25519: invalid point encoding")
|
||||
}
|
||||
|
||||
// Select the negative square root if the sign bit is set.
|
||||
xxNeg := new(field.Element).Negate(xx)
|
||||
xx = xx.Select(xxNeg, xx, int(x[31]>>7))
|
||||
|
||||
v.x.Set(xx)
|
||||
v.y.Set(y)
|
||||
v.z.One()
|
||||
v.t.Multiply(xx, y) // xy = T / Z
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func copyFieldElement(buf *[32]byte, v *field.Element) []byte {
|
||||
copy(buf[:], v.Bytes())
|
||||
return buf[:]
|
||||
}
|
||||
|
||||
// Conversions.
|
||||
|
||||
func (v *projP2) FromP1xP1(p *projP1xP1) *projP2 {
|
||||
v.X.Multiply(&p.X, &p.T)
|
||||
v.Y.Multiply(&p.Y, &p.Z)
|
||||
v.Z.Multiply(&p.Z, &p.T)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *projP2) FromP3(p *Point) *projP2 {
|
||||
v.X.Set(&p.x)
|
||||
v.Y.Set(&p.y)
|
||||
v.Z.Set(&p.z)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *Point) fromP1xP1(p *projP1xP1) *Point {
|
||||
v.x.Multiply(&p.X, &p.T)
|
||||
v.y.Multiply(&p.Y, &p.Z)
|
||||
v.z.Multiply(&p.Z, &p.T)
|
||||
v.t.Multiply(&p.X, &p.Y)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *Point) fromP2(p *projP2) *Point {
|
||||
v.x.Multiply(&p.X, &p.Z)
|
||||
v.y.Multiply(&p.Y, &p.Z)
|
||||
v.z.Square(&p.Z)
|
||||
v.t.Multiply(&p.X, &p.Y)
|
||||
return v
|
||||
}
|
||||
|
||||
// d is a constant in the curve equation.
|
||||
var d, _ = new(field.Element).SetBytes([]byte{
|
||||
0xa3, 0x78, 0x59, 0x13, 0xca, 0x4d, 0xeb, 0x75,
|
||||
0xab, 0xd8, 0x41, 0x41, 0x4d, 0x0a, 0x70, 0x00,
|
||||
0x98, 0xe8, 0x79, 0x77, 0x79, 0x40, 0xc7, 0x8c,
|
||||
0x73, 0xfe, 0x6f, 0x2b, 0xee, 0x6c, 0x03, 0x52})
|
||||
var d2 = new(field.Element).Add(d, d)
|
||||
|
||||
func (v *projCached) FromP3(p *Point) *projCached {
|
||||
v.YplusX.Add(&p.y, &p.x)
|
||||
v.YminusX.Subtract(&p.y, &p.x)
|
||||
v.Z.Set(&p.z)
|
||||
v.T2d.Multiply(&p.t, d2)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *affineCached) FromP3(p *Point) *affineCached {
|
||||
v.YplusX.Add(&p.y, &p.x)
|
||||
v.YminusX.Subtract(&p.y, &p.x)
|
||||
v.T2d.Multiply(&p.t, d2)
|
||||
|
||||
var invZ field.Element
|
||||
invZ.Invert(&p.z)
|
||||
v.YplusX.Multiply(&v.YplusX, &invZ)
|
||||
v.YminusX.Multiply(&v.YminusX, &invZ)
|
||||
v.T2d.Multiply(&v.T2d, &invZ)
|
||||
return v
|
||||
}
|
||||
|
||||
// (Re)addition and subtraction.
|
||||
|
||||
// Add sets v = p + q, and returns v.
|
||||
func (v *Point) Add(p, q *Point) *Point {
|
||||
checkInitialized(p, q)
|
||||
qCached := new(projCached).FromP3(q)
|
||||
result := new(projP1xP1).Add(p, qCached)
|
||||
return v.fromP1xP1(result)
|
||||
}
|
||||
|
||||
// Subtract sets v = p - q, and returns v.
|
||||
func (v *Point) Subtract(p, q *Point) *Point {
|
||||
checkInitialized(p, q)
|
||||
qCached := new(projCached).FromP3(q)
|
||||
result := new(projP1xP1).Sub(p, qCached)
|
||||
return v.fromP1xP1(result)
|
||||
}
|
||||
|
||||
func (v *projP1xP1) Add(p *Point, q *projCached) *projP1xP1 {
|
||||
var YplusX, YminusX, PP, MM, TT2d, ZZ2 field.Element
|
||||
|
||||
YplusX.Add(&p.y, &p.x)
|
||||
YminusX.Subtract(&p.y, &p.x)
|
||||
|
||||
PP.Multiply(&YplusX, &q.YplusX)
|
||||
MM.Multiply(&YminusX, &q.YminusX)
|
||||
TT2d.Multiply(&p.t, &q.T2d)
|
||||
ZZ2.Multiply(&p.z, &q.Z)
|
||||
|
||||
ZZ2.Add(&ZZ2, &ZZ2)
|
||||
|
||||
v.X.Subtract(&PP, &MM)
|
||||
v.Y.Add(&PP, &MM)
|
||||
v.Z.Add(&ZZ2, &TT2d)
|
||||
v.T.Subtract(&ZZ2, &TT2d)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *projP1xP1) Sub(p *Point, q *projCached) *projP1xP1 {
|
||||
var YplusX, YminusX, PP, MM, TT2d, ZZ2 field.Element
|
||||
|
||||
YplusX.Add(&p.y, &p.x)
|
||||
YminusX.Subtract(&p.y, &p.x)
|
||||
|
||||
PP.Multiply(&YplusX, &q.YminusX) // flipped sign
|
||||
MM.Multiply(&YminusX, &q.YplusX) // flipped sign
|
||||
TT2d.Multiply(&p.t, &q.T2d)
|
||||
ZZ2.Multiply(&p.z, &q.Z)
|
||||
|
||||
ZZ2.Add(&ZZ2, &ZZ2)
|
||||
|
||||
v.X.Subtract(&PP, &MM)
|
||||
v.Y.Add(&PP, &MM)
|
||||
v.Z.Subtract(&ZZ2, &TT2d) // flipped sign
|
||||
v.T.Add(&ZZ2, &TT2d) // flipped sign
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *projP1xP1) AddAffine(p *Point, q *affineCached) *projP1xP1 {
|
||||
var YplusX, YminusX, PP, MM, TT2d, Z2 field.Element
|
||||
|
||||
YplusX.Add(&p.y, &p.x)
|
||||
YminusX.Subtract(&p.y, &p.x)
|
||||
|
||||
PP.Multiply(&YplusX, &q.YplusX)
|
||||
MM.Multiply(&YminusX, &q.YminusX)
|
||||
TT2d.Multiply(&p.t, &q.T2d)
|
||||
|
||||
Z2.Add(&p.z, &p.z)
|
||||
|
||||
v.X.Subtract(&PP, &MM)
|
||||
v.Y.Add(&PP, &MM)
|
||||
v.Z.Add(&Z2, &TT2d)
|
||||
v.T.Subtract(&Z2, &TT2d)
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *projP1xP1) SubAffine(p *Point, q *affineCached) *projP1xP1 {
|
||||
var YplusX, YminusX, PP, MM, TT2d, Z2 field.Element
|
||||
|
||||
YplusX.Add(&p.y, &p.x)
|
||||
YminusX.Subtract(&p.y, &p.x)
|
||||
|
||||
PP.Multiply(&YplusX, &q.YminusX) // flipped sign
|
||||
MM.Multiply(&YminusX, &q.YplusX) // flipped sign
|
||||
TT2d.Multiply(&p.t, &q.T2d)
|
||||
|
||||
Z2.Add(&p.z, &p.z)
|
||||
|
||||
v.X.Subtract(&PP, &MM)
|
||||
v.Y.Add(&PP, &MM)
|
||||
v.Z.Subtract(&Z2, &TT2d) // flipped sign
|
||||
v.T.Add(&Z2, &TT2d) // flipped sign
|
||||
return v
|
||||
}
|
||||
|
||||
// Doubling.
|
||||
|
||||
func (v *projP1xP1) Double(p *projP2) *projP1xP1 {
|
||||
var XX, YY, ZZ2, XplusYsq field.Element
|
||||
|
||||
XX.Square(&p.X)
|
||||
YY.Square(&p.Y)
|
||||
ZZ2.Square(&p.Z)
|
||||
ZZ2.Add(&ZZ2, &ZZ2)
|
||||
XplusYsq.Add(&p.X, &p.Y)
|
||||
XplusYsq.Square(&XplusYsq)
|
||||
|
||||
v.Y.Add(&YY, &XX)
|
||||
v.Z.Subtract(&YY, &XX)
|
||||
|
||||
v.X.Subtract(&XplusYsq, &v.Y)
|
||||
v.T.Subtract(&ZZ2, &v.Z)
|
||||
return v
|
||||
}
|
||||
|
||||
// Negation.
|
||||
|
||||
// Negate sets v = -p, and returns v.
|
||||
func (v *Point) Negate(p *Point) *Point {
|
||||
checkInitialized(p)
|
||||
v.x.Negate(&p.x)
|
||||
v.y.Set(&p.y)
|
||||
v.z.Set(&p.z)
|
||||
v.t.Negate(&p.t)
|
||||
return v
|
||||
}
|
||||
|
||||
// Equal returns 1 if v is equivalent to u, and 0 otherwise.
|
||||
func (v *Point) Equal(u *Point) int {
|
||||
checkInitialized(v, u)
|
||||
|
||||
var t1, t2, t3, t4 field.Element
|
||||
t1.Multiply(&v.x, &u.z)
|
||||
t2.Multiply(&u.x, &v.z)
|
||||
t3.Multiply(&v.y, &u.z)
|
||||
t4.Multiply(&u.y, &v.z)
|
||||
|
||||
return t1.Equal(&t2) & t3.Equal(&t4)
|
||||
}
|
||||
|
||||
// Constant-time operations
|
||||
|
||||
// Select sets v to a if cond == 1 and to b if cond == 0.
|
||||
func (v *projCached) Select(a, b *projCached, cond int) *projCached {
|
||||
v.YplusX.Select(&a.YplusX, &b.YplusX, cond)
|
||||
v.YminusX.Select(&a.YminusX, &b.YminusX, cond)
|
||||
v.Z.Select(&a.Z, &b.Z, cond)
|
||||
v.T2d.Select(&a.T2d, &b.T2d, cond)
|
||||
return v
|
||||
}
|
||||
|
||||
// Select sets v to a if cond == 1 and to b if cond == 0.
|
||||
func (v *affineCached) Select(a, b *affineCached, cond int) *affineCached {
|
||||
v.YplusX.Select(&a.YplusX, &b.YplusX, cond)
|
||||
v.YminusX.Select(&a.YminusX, &b.YminusX, cond)
|
||||
v.T2d.Select(&a.T2d, &b.T2d, cond)
|
||||
return v
|
||||
}
|
||||
|
||||
// CondNeg negates v if cond == 1 and leaves it unchanged if cond == 0.
|
||||
func (v *projCached) CondNeg(cond int) *projCached {
|
||||
v.YplusX.Swap(&v.YminusX, cond)
|
||||
v.T2d.Select(new(field.Element).Negate(&v.T2d), &v.T2d, cond)
|
||||
return v
|
||||
}
|
||||
|
||||
// CondNeg negates v if cond == 1 and leaves it unchanged if cond == 0.
|
||||
func (v *affineCached) CondNeg(cond int) *affineCached {
|
||||
v.YplusX.Swap(&v.YminusX, cond)
|
||||
v.T2d.Select(new(field.Element).Negate(&v.T2d), &v.T2d, cond)
|
||||
return v
|
||||
}
|
@ -0,0 +1,349 @@
|
||||
// Copyright (c) 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package edwards25519
|
||||
|
||||
// This file contains additional functionality that is not included in the
|
||||
// upstream crypto/internal/edwards25519 package.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"filippo.io/edwards25519/field"
|
||||
)
|
||||
|
||||
// ExtendedCoordinates returns v in extended coordinates (X:Y:Z:T) where
|
||||
// x = X/Z, y = Y/Z, and xy = T/Z as in https://eprint.iacr.org/2008/522.
|
||||
func (v *Point) ExtendedCoordinates() (X, Y, Z, T *field.Element) {
|
||||
// This function is outlined to make the allocations inline in the caller
|
||||
// rather than happen on the heap. Don't change the style without making
|
||||
// sure it doesn't increase the inliner cost.
|
||||
var e [4]field.Element
|
||||
X, Y, Z, T = v.extendedCoordinates(&e)
|
||||
return
|
||||
}
|
||||
|
||||
func (v *Point) extendedCoordinates(e *[4]field.Element) (X, Y, Z, T *field.Element) {
|
||||
checkInitialized(v)
|
||||
X = e[0].Set(&v.x)
|
||||
Y = e[1].Set(&v.y)
|
||||
Z = e[2].Set(&v.z)
|
||||
T = e[3].Set(&v.t)
|
||||
return
|
||||
}
|
||||
|
||||
// SetExtendedCoordinates sets v = (X:Y:Z:T) in extended coordinates where
|
||||
// x = X/Z, y = Y/Z, and xy = T/Z as in https://eprint.iacr.org/2008/522.
|
||||
//
|
||||
// If the coordinates are invalid or don't represent a valid point on the curve,
|
||||
// SetExtendedCoordinates returns nil and an error and the receiver is
|
||||
// unchanged. Otherwise, SetExtendedCoordinates returns v.
|
||||
func (v *Point) SetExtendedCoordinates(X, Y, Z, T *field.Element) (*Point, error) {
|
||||
if !isOnCurve(X, Y, Z, T) {
|
||||
return nil, errors.New("edwards25519: invalid point coordinates")
|
||||
}
|
||||
v.x.Set(X)
|
||||
v.y.Set(Y)
|
||||
v.z.Set(Z)
|
||||
v.t.Set(T)
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func isOnCurve(X, Y, Z, T *field.Element) bool {
|
||||
var lhs, rhs field.Element
|
||||
XX := new(field.Element).Square(X)
|
||||
YY := new(field.Element).Square(Y)
|
||||
ZZ := new(field.Element).Square(Z)
|
||||
TT := new(field.Element).Square(T)
|
||||
// -x² + y² = 1 + dx²y²
|
||||
// -(X/Z)² + (Y/Z)² = 1 + d(T/Z)²
|
||||
// -X² + Y² = Z² + dT²
|
||||
lhs.Subtract(YY, XX)
|
||||
rhs.Multiply(d, TT).Add(&rhs, ZZ)
|
||||
if lhs.Equal(&rhs) != 1 {
|
||||
return false
|
||||
}
|
||||
// xy = T/Z
|
||||
// XY/Z² = T/Z
|
||||
// XY = TZ
|
||||
lhs.Multiply(X, Y)
|
||||
rhs.Multiply(T, Z)
|
||||
return lhs.Equal(&rhs) == 1
|
||||
}
|
||||
|
||||
// BytesMontgomery converts v to a point on the birationally-equivalent
|
||||
// Curve25519 Montgomery curve, and returns its canonical 32 bytes encoding
|
||||
// according to RFC 7748.
|
||||
//
|
||||
// Note that BytesMontgomery only encodes the u-coordinate, so v and -v encode
|
||||
// to the same value. If v is the identity point, BytesMontgomery returns 32
|
||||
// zero bytes, analogously to the X25519 function.
|
||||
//
|
||||
// The lack of an inverse operation (such as SetMontgomeryBytes) is deliberate:
|
||||
// while every valid edwards25519 point has a unique u-coordinate Montgomery
|
||||
// encoding, X25519 accepts inputs on the quadratic twist, which don't correspond
|
||||
// to any edwards25519 point, and every other X25519 input corresponds to two
|
||||
// edwards25519 points.
|
||||
func (v *Point) BytesMontgomery() []byte {
|
||||
// This function is outlined to make the allocations inline in the caller
|
||||
// rather than happen on the heap.
|
||||
var buf [32]byte
|
||||
return v.bytesMontgomery(&buf)
|
||||
}
|
||||
|
||||
func (v *Point) bytesMontgomery(buf *[32]byte) []byte {
|
||||
checkInitialized(v)
|
||||
|
||||
// RFC 7748, Section 4.1 provides the bilinear map to calculate the
|
||||
// Montgomery u-coordinate
|
||||
//
|
||||
// u = (1 + y) / (1 - y)
|
||||
//
|
||||
// where y = Y / Z.
|
||||
|
||||
var y, recip, u field.Element
|
||||
|
||||
y.Multiply(&v.y, y.Invert(&v.z)) // y = Y / Z
|
||||
recip.Invert(recip.Subtract(feOne, &y)) // r = 1/(1 - y)
|
||||
u.Multiply(u.Add(feOne, &y), &recip) // u = (1 + y)*r
|
||||
|
||||
return copyFieldElement(buf, &u)
|
||||
}
|
||||
|
||||
// MultByCofactor sets v = 8 * p, and returns v.
|
||||
func (v *Point) MultByCofactor(p *Point) *Point {
|
||||
checkInitialized(p)
|
||||
result := projP1xP1{}
|
||||
pp := (&projP2{}).FromP3(p)
|
||||
result.Double(pp)
|
||||
pp.FromP1xP1(&result)
|
||||
result.Double(pp)
|
||||
pp.FromP1xP1(&result)
|
||||
result.Double(pp)
|
||||
return v.fromP1xP1(&result)
|
||||
}
|
||||
|
||||
// Given k > 0, set s = s**(2*i).
|
||||
func (s *Scalar) pow2k(k int) {
|
||||
for i := 0; i < k; i++ {
|
||||
s.Multiply(s, s)
|
||||
}
|
||||
}
|
||||
|
||||
// Invert sets s to the inverse of a nonzero scalar v, and returns s.
|
||||
//
|
||||
// If t is zero, Invert returns zero.
|
||||
func (s *Scalar) Invert(t *Scalar) *Scalar {
|
||||
// Uses a hardcoded sliding window of width 4.
|
||||
var table [8]Scalar
|
||||
var tt Scalar
|
||||
tt.Multiply(t, t)
|
||||
table[0] = *t
|
||||
for i := 0; i < 7; i++ {
|
||||
table[i+1].Multiply(&table[i], &tt)
|
||||
}
|
||||
// Now table = [t**1, t**3, t**5, t**7, t**9, t**11, t**13, t**15]
|
||||
// so t**k = t[k/2] for odd k
|
||||
|
||||
// To compute the sliding window digits, use the following Sage script:
|
||||
|
||||
// sage: import itertools
|
||||
// sage: def sliding_window(w,k):
|
||||
// ....: digits = []
|
||||
// ....: while k > 0:
|
||||
// ....: if k % 2 == 1:
|
||||
// ....: kmod = k % (2**w)
|
||||
// ....: digits.append(kmod)
|
||||
// ....: k = k - kmod
|
||||
// ....: else:
|
||||
// ....: digits.append(0)
|
||||
// ....: k = k // 2
|
||||
// ....: return digits
|
||||
|
||||
// Now we can compute s roughly as follows:
|
||||
|
||||
// sage: s = 1
|
||||
// sage: for coeff in reversed(sliding_window(4,l-2)):
|
||||
// ....: s = s*s
|
||||
// ....: if coeff > 0 :
|
||||
// ....: s = s*t**coeff
|
||||
|
||||
// This works on one bit at a time, with many runs of zeros.
|
||||
// The digits can be collapsed into [(count, coeff)] as follows:
|
||||
|
||||
// sage: [(len(list(group)),d) for d,group in itertools.groupby(sliding_window(4,l-2))]
|
||||
|
||||
// Entries of the form (k, 0) turn into pow2k(k)
|
||||
// Entries of the form (1, coeff) turn into a squaring and then a table lookup.
|
||||
// We can fold the squaring into the previous pow2k(k) as pow2k(k+1).
|
||||
|
||||
*s = table[1/2]
|
||||
s.pow2k(127 + 1)
|
||||
s.Multiply(s, &table[1/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[9/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[11/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[13/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[15/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[7/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[15/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[5/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[1/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[15/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[15/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[7/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[3/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[11/2])
|
||||
s.pow2k(5 + 1)
|
||||
s.Multiply(s, &table[11/2])
|
||||
s.pow2k(9 + 1)
|
||||
s.Multiply(s, &table[9/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[3/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[3/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[3/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[9/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[7/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[3/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[13/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[7/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[9/2])
|
||||
s.pow2k(3 + 1)
|
||||
s.Multiply(s, &table[15/2])
|
||||
s.pow2k(4 + 1)
|
||||
s.Multiply(s, &table[11/2])
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
// MultiScalarMult sets v = sum(scalars[i] * points[i]), and returns v.
|
||||
//
|
||||
// Execution time depends only on the lengths of the two slices, which must match.
|
||||
func (v *Point) MultiScalarMult(scalars []*Scalar, points []*Point) *Point {
|
||||
if len(scalars) != len(points) {
|
||||
panic("edwards25519: called MultiScalarMult with different size inputs")
|
||||
}
|
||||
checkInitialized(points...)
|
||||
|
||||
// Proceed as in the single-base case, but share doublings
|
||||
// between each point in the multiscalar equation.
|
||||
|
||||
// Build lookup tables for each point
|
||||
tables := make([]projLookupTable, len(points))
|
||||
for i := range tables {
|
||||
tables[i].FromP3(points[i])
|
||||
}
|
||||
// Compute signed radix-16 digits for each scalar
|
||||
digits := make([][64]int8, len(scalars))
|
||||
for i := range digits {
|
||||
digits[i] = scalars[i].signedRadix16()
|
||||
}
|
||||
|
||||
// Unwrap first loop iteration to save computing 16*identity
|
||||
multiple := &projCached{}
|
||||
tmp1 := &projP1xP1{}
|
||||
tmp2 := &projP2{}
|
||||
// Lookup-and-add the appropriate multiple of each input point
|
||||
for j := range tables {
|
||||
tables[j].SelectInto(multiple, digits[j][63])
|
||||
tmp1.Add(v, multiple) // tmp1 = v + x_(j,63)*Q in P1xP1 coords
|
||||
v.fromP1xP1(tmp1) // update v
|
||||
}
|
||||
tmp2.FromP3(v) // set up tmp2 = v in P2 coords for next iteration
|
||||
for i := 62; i >= 0; i-- {
|
||||
tmp1.Double(tmp2) // tmp1 = 2*(prev) in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 2*(prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 4*(prev) in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 4*(prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 8*(prev) in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 8*(prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 16*(prev) in P1xP1 coords
|
||||
v.fromP1xP1(tmp1) // v = 16*(prev) in P3 coords
|
||||
// Lookup-and-add the appropriate multiple of each input point
|
||||
for j := range tables {
|
||||
tables[j].SelectInto(multiple, digits[j][i])
|
||||
tmp1.Add(v, multiple) // tmp1 = v + x_(j,i)*Q in P1xP1 coords
|
||||
v.fromP1xP1(tmp1) // update v
|
||||
}
|
||||
tmp2.FromP3(v) // set up tmp2 = v in P2 coords for next iteration
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// VarTimeMultiScalarMult sets v = sum(scalars[i] * points[i]), and returns v.
|
||||
//
|
||||
// Execution time depends on the inputs.
|
||||
func (v *Point) VarTimeMultiScalarMult(scalars []*Scalar, points []*Point) *Point {
|
||||
if len(scalars) != len(points) {
|
||||
panic("edwards25519: called VarTimeMultiScalarMult with different size inputs")
|
||||
}
|
||||
checkInitialized(points...)
|
||||
|
||||
// Generalize double-base NAF computation to arbitrary sizes.
|
||||
// Here all the points are dynamic, so we only use the smaller
|
||||
// tables.
|
||||
|
||||
// Build lookup tables for each point
|
||||
tables := make([]nafLookupTable5, len(points))
|
||||
for i := range tables {
|
||||
tables[i].FromP3(points[i])
|
||||
}
|
||||
// Compute a NAF for each scalar
|
||||
nafs := make([][256]int8, len(scalars))
|
||||
for i := range nafs {
|
||||
nafs[i] = scalars[i].nonAdjacentForm(5)
|
||||
}
|
||||
|
||||
multiple := &projCached{}
|
||||
tmp1 := &projP1xP1{}
|
||||
tmp2 := &projP2{}
|
||||
tmp2.Zero()
|
||||
|
||||
// Move from high to low bits, doubling the accumulator
|
||||
// at each iteration and checking whether there is a nonzero
|
||||
// coefficient to look up a multiple of.
|
||||
//
|
||||
// Skip trying to find the first nonzero coefficent, because
|
||||
// searching might be more work than a few extra doublings.
|
||||
for i := 255; i >= 0; i-- {
|
||||
tmp1.Double(tmp2)
|
||||
|
||||
for j := range nafs {
|
||||
if nafs[j][i] > 0 {
|
||||
v.fromP1xP1(tmp1)
|
||||
tables[j].SelectInto(multiple, nafs[j][i])
|
||||
tmp1.Add(v, multiple)
|
||||
} else if nafs[j][i] < 0 {
|
||||
v.fromP1xP1(tmp1)
|
||||
tables[j].SelectInto(multiple, -nafs[j][i])
|
||||
tmp1.Sub(v, multiple)
|
||||
}
|
||||
}
|
||||
|
||||
tmp2.FromP1xP1(tmp1)
|
||||
}
|
||||
|
||||
v.fromP2(tmp2)
|
||||
return v
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
|
||||
|
||||
//go:build amd64 && gc && !purego
|
||||
// +build amd64,gc,!purego
|
||||
|
||||
package field
|
||||
|
||||
// feMul sets out = a * b. It works like feMulGeneric.
|
||||
//
|
||||
//go:noescape
|
||||
func feMul(out *Element, a *Element, b *Element)
|
||||
|
||||
// feSquare sets out = a * a. It works like feSquareGeneric.
|
||||
//
|
||||
//go:noescape
|
||||
func feSquare(out *Element, a *Element)
|
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !amd64 || !gc || purego
|
||||
// +build !amd64 !gc purego
|
||||
|
||||
package field
|
||||
|
||||
func feMul(v, x, y *Element) { feMulGeneric(v, x, y) }
|
||||
|
||||
func feSquare(v, x *Element) { feSquareGeneric(v, x) }
|
@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build arm64 && gc && !purego
|
||||
// +build arm64,gc,!purego
|
||||
|
||||
package field
|
||||
|
||||
//go:noescape
|
||||
func carryPropagate(v *Element)
|
||||
|
||||
func (v *Element) carryPropagate() *Element {
|
||||
carryPropagate(v)
|
||||
return v
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build arm64 && gc && !purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// carryPropagate works exactly like carryPropagateGeneric and uses the
|
||||
// same AND, ADD, and LSR+MADD instructions emitted by the compiler, but
|
||||
// avoids loading R0-R4 twice and uses LDP and STP.
|
||||
//
|
||||
// See https://golang.org/issues/43145 for the main compiler issue.
|
||||
//
|
||||
// func carryPropagate(v *Element)
|
||||
TEXT ·carryPropagate(SB),NOFRAME|NOSPLIT,$0-8
|
||||
MOVD v+0(FP), R20
|
||||
|
||||
LDP 0(R20), (R0, R1)
|
||||
LDP 16(R20), (R2, R3)
|
||||
MOVD 32(R20), R4
|
||||
|
||||
AND $0x7ffffffffffff, R0, R10
|
||||
AND $0x7ffffffffffff, R1, R11
|
||||
AND $0x7ffffffffffff, R2, R12
|
||||
AND $0x7ffffffffffff, R3, R13
|
||||
AND $0x7ffffffffffff, R4, R14
|
||||
|
||||
ADD R0>>51, R11, R11
|
||||
ADD R1>>51, R12, R12
|
||||
ADD R2>>51, R13, R13
|
||||
ADD R3>>51, R14, R14
|
||||
// R4>>51 * 19 + R10 -> R10
|
||||
LSR $51, R4, R21
|
||||
MOVD $19, R22
|
||||
MADD R22, R10, R21, R10
|
||||
|
||||
STP (R10, R11), 0(R20)
|
||||
STP (R12, R13), 16(R20)
|
||||
MOVD R14, 32(R20)
|
||||
|
||||
RET
|
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !arm64 || !gc || purego
|
||||
// +build !arm64 !gc purego
|
||||
|
||||
package field
|
||||
|
||||
func (v *Element) carryPropagate() *Element {
|
||||
return v.carryPropagateGeneric()
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package field
|
||||
|
||||
import "errors"
|
||||
|
||||
// This file contains additional functionality that is not included in the
|
||||
// upstream crypto/ed25519/edwards25519/field package.
|
||||
|
||||
// SetWideBytes sets v to x, where x is a 64-byte little-endian encoding, which
|
||||
// is reduced modulo the field order. If x is not of the right length,
|
||||
// SetWideBytes returns nil and an error, and the receiver is unchanged.
|
||||
//
|
||||
// SetWideBytes is not necessary to select a uniformly distributed value, and is
|
||||
// only provided for compatibility: SetBytes can be used instead as the chance
|
||||
// of bias is less than 2⁻²⁵⁰.
|
||||
func (v *Element) SetWideBytes(x []byte) (*Element, error) {
|
||||
if len(x) != 64 {
|
||||
return nil, errors.New("edwards25519: invalid SetWideBytes input size")
|
||||
}
|
||||
|
||||
// Split the 64 bytes into two elements, and extract the most significant
|
||||
// bit of each, which is ignored by SetBytes.
|
||||
lo, _ := new(Element).SetBytes(x[:32])
|
||||
loMSB := uint64(x[31] >> 7)
|
||||
hi, _ := new(Element).SetBytes(x[32:])
|
||||
hiMSB := uint64(x[63] >> 7)
|
||||
|
||||
// The output we want is
|
||||
//
|
||||
// v = lo + loMSB * 2²⁵⁵ + hi * 2²⁵⁶ + hiMSB * 2⁵¹¹
|
||||
//
|
||||
// which applying the reduction identity comes out to
|
||||
//
|
||||
// v = lo + loMSB * 19 + hi * 2 * 19 + hiMSB * 2 * 19²
|
||||
//
|
||||
// l0 will be the sum of a 52 bits value (lo.l0), plus a 5 bits value
|
||||
// (loMSB * 19), a 6 bits value (hi.l0 * 2 * 19), and a 10 bits value
|
||||
// (hiMSB * 2 * 19²), so it fits in a uint64.
|
||||
|
||||
v.l0 = lo.l0 + loMSB*19 + hi.l0*2*19 + hiMSB*2*19*19
|
||||
v.l1 = lo.l1 + hi.l1*2*19
|
||||
v.l2 = lo.l2 + hi.l2*2*19
|
||||
v.l3 = lo.l3 + hi.l3*2*19
|
||||
v.l4 = lo.l4 + hi.l4*2*19
|
||||
|
||||
return v.carryPropagate(), nil
|
||||
}
|
@ -0,0 +1,343 @@
|
||||
// Copyright (c) 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package edwards25519
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// A Scalar is an integer modulo
|
||||
//
|
||||
// l = 2^252 + 27742317777372353535851937790883648493
|
||||
//
|
||||
// which is the prime order of the edwards25519 group.
|
||||
//
|
||||
// This type works similarly to math/big.Int, and all arguments and
|
||||
// receivers are allowed to alias.
|
||||
//
|
||||
// The zero value is a valid zero element.
|
||||
type Scalar struct {
|
||||
// s is the scalar in the Montgomery domain, in the format of the
|
||||
// fiat-crypto implementation.
|
||||
s fiatScalarMontgomeryDomainFieldElement
|
||||
}
|
||||
|
||||
// The field implementation in scalar_fiat.go is generated by the fiat-crypto
|
||||
// project (https://github.com/mit-plv/fiat-crypto) at version v0.0.9 (23d2dbc)
|
||||
// from a formally verified model.
|
||||
//
|
||||
// fiat-crypto code comes under the following license.
|
||||
//
|
||||
// Copyright (c) 2015-2020 The fiat-crypto Authors. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY the fiat-crypto authors "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design,
|
||||
// Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// NewScalar returns a new zero Scalar.
|
||||
func NewScalar() *Scalar {
|
||||
return &Scalar{}
|
||||
}
|
||||
|
||||
// MultiplyAdd sets s = x * y + z mod l, and returns s. It is equivalent to
|
||||
// using Multiply and then Add.
|
||||
func (s *Scalar) MultiplyAdd(x, y, z *Scalar) *Scalar {
|
||||
// Make a copy of z in case it aliases s.
|
||||
zCopy := new(Scalar).Set(z)
|
||||
return s.Multiply(x, y).Add(s, zCopy)
|
||||
}
|
||||
|
||||
// Add sets s = x + y mod l, and returns s.
|
||||
func (s *Scalar) Add(x, y *Scalar) *Scalar {
|
||||
// s = 1 * x + y mod l
|
||||
fiatScalarAdd(&s.s, &x.s, &y.s)
|
||||
return s
|
||||
}
|
||||
|
||||
// Subtract sets s = x - y mod l, and returns s.
|
||||
func (s *Scalar) Subtract(x, y *Scalar) *Scalar {
|
||||
// s = -1 * y + x mod l
|
||||
fiatScalarSub(&s.s, &x.s, &y.s)
|
||||
return s
|
||||
}
|
||||
|
||||
// Negate sets s = -x mod l, and returns s.
|
||||
func (s *Scalar) Negate(x *Scalar) *Scalar {
|
||||
// s = -1 * x + 0 mod l
|
||||
fiatScalarOpp(&s.s, &x.s)
|
||||
return s
|
||||
}
|
||||
|
||||
// Multiply sets s = x * y mod l, and returns s.
|
||||
func (s *Scalar) Multiply(x, y *Scalar) *Scalar {
|
||||
// s = x * y + 0 mod l
|
||||
fiatScalarMul(&s.s, &x.s, &y.s)
|
||||
return s
|
||||
}
|
||||
|
||||
// Set sets s = x, and returns s.
|
||||
func (s *Scalar) Set(x *Scalar) *Scalar {
|
||||
*s = *x
|
||||
return s
|
||||
}
|
||||
|
||||
// SetUniformBytes sets s = x mod l, where x is a 64-byte little-endian integer.
|
||||
// If x is not of the right length, SetUniformBytes returns nil and an error,
|
||||
// and the receiver is unchanged.
|
||||
//
|
||||
// SetUniformBytes can be used to set s to a uniformly distributed value given
|
||||
// 64 uniformly distributed random bytes.
|
||||
func (s *Scalar) SetUniformBytes(x []byte) (*Scalar, error) {
|
||||
if len(x) != 64 {
|
||||
return nil, errors.New("edwards25519: invalid SetUniformBytes input length")
|
||||
}
|
||||
|
||||
// We have a value x of 512 bits, but our fiatScalarFromBytes function
|
||||
// expects an input lower than l, which is a little over 252 bits.
|
||||
//
|
||||
// Instead of writing a reduction function that operates on wider inputs, we
|
||||
// can interpret x as the sum of three shorter values a, b, and c.
|
||||
//
|
||||
// x = a + b * 2^168 + c * 2^336 mod l
|
||||
//
|
||||
// We then precompute 2^168 and 2^336 modulo l, and perform the reduction
|
||||
// with two multiplications and two additions.
|
||||
|
||||
s.setShortBytes(x[:21])
|
||||
t := new(Scalar).setShortBytes(x[21:42])
|
||||
s.Add(s, t.Multiply(t, scalarTwo168))
|
||||
t.setShortBytes(x[42:])
|
||||
s.Add(s, t.Multiply(t, scalarTwo336))
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// scalarTwo168 and scalarTwo336 are 2^168 and 2^336 modulo l, encoded as a
|
||||
// fiatScalarMontgomeryDomainFieldElement, which is a little-endian 4-limb value
|
||||
// in the 2^256 Montgomery domain.
|
||||
var scalarTwo168 = &Scalar{s: [4]uint64{0x5b8ab432eac74798, 0x38afddd6de59d5d7,
|
||||
0xa2c131b399411b7c, 0x6329a7ed9ce5a30}}
|
||||
var scalarTwo336 = &Scalar{s: [4]uint64{0xbd3d108e2b35ecc5, 0x5c3a3718bdf9c90b,
|
||||
0x63aa97a331b4f2ee, 0x3d217f5be65cb5c}}
|
||||
|
||||
// setShortBytes sets s = x mod l, where x is a little-endian integer shorter
|
||||
// than 32 bytes.
|
||||
func (s *Scalar) setShortBytes(x []byte) *Scalar {
|
||||
if len(x) >= 32 {
|
||||
panic("edwards25519: internal error: setShortBytes called with a long string")
|
||||
}
|
||||
var buf [32]byte
|
||||
copy(buf[:], x)
|
||||
fiatScalarFromBytes((*[4]uint64)(&s.s), &buf)
|
||||
fiatScalarToMontgomery(&s.s, (*fiatScalarNonMontgomeryDomainFieldElement)(&s.s))
|
||||
return s
|
||||
}
|
||||
|
||||
// SetCanonicalBytes sets s = x, where x is a 32-byte little-endian encoding of
|
||||
// s, and returns s. If x is not a canonical encoding of s, SetCanonicalBytes
|
||||
// returns nil and an error, and the receiver is unchanged.
|
||||
func (s *Scalar) SetCanonicalBytes(x []byte) (*Scalar, error) {
|
||||
if len(x) != 32 {
|
||||
return nil, errors.New("invalid scalar length")
|
||||
}
|
||||
if !isReduced(x) {
|
||||
return nil, errors.New("invalid scalar encoding")
|
||||
}
|
||||
|
||||
fiatScalarFromBytes((*[4]uint64)(&s.s), (*[32]byte)(x))
|
||||
fiatScalarToMontgomery(&s.s, (*fiatScalarNonMontgomeryDomainFieldElement)(&s.s))
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// scalarMinusOneBytes is l - 1 in little endian.
|
||||
var scalarMinusOneBytes = [32]byte{236, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16}
|
||||
|
||||
// isReduced returns whether the given scalar in 32-byte little endian encoded
|
||||
// form is reduced modulo l.
|
||||
func isReduced(s []byte) bool {
|
||||
if len(s) != 32 {
|
||||
return false
|
||||
}
|
||||
|
||||
for i := len(s) - 1; i >= 0; i-- {
|
||||
switch {
|
||||
case s[i] > scalarMinusOneBytes[i]:
|
||||
return false
|
||||
case s[i] < scalarMinusOneBytes[i]:
|
||||
return true
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// SetBytesWithClamping applies the buffer pruning described in RFC 8032,
|
||||
// Section 5.1.5 (also known as clamping) and sets s to the result. The input
|
||||
// must be 32 bytes, and it is not modified. If x is not of the right length,
|
||||
// SetBytesWithClamping returns nil and an error, and the receiver is unchanged.
|
||||
//
|
||||
// Note that since Scalar values are always reduced modulo the prime order of
|
||||
// the curve, the resulting value will not preserve any of the cofactor-clearing
|
||||
// properties that clamping is meant to provide. It will however work as
|
||||
// expected as long as it is applied to points on the prime order subgroup, like
|
||||
// in Ed25519. In fact, it is lost to history why RFC 8032 adopted the
|
||||
// irrelevant RFC 7748 clamping, but it is now required for compatibility.
|
||||
func (s *Scalar) SetBytesWithClamping(x []byte) (*Scalar, error) {
|
||||
// The description above omits the purpose of the high bits of the clamping
|
||||
// for brevity, but those are also lost to reductions, and are also
|
||||
// irrelevant to edwards25519 as they protect against a specific
|
||||
// implementation bug that was once observed in a generic Montgomery ladder.
|
||||
if len(x) != 32 {
|
||||
return nil, errors.New("edwards25519: invalid SetBytesWithClamping input length")
|
||||
}
|
||||
|
||||
// We need to use the wide reduction from SetUniformBytes, since clamping
|
||||
// sets the 2^254 bit, making the value higher than the order.
|
||||
var wideBytes [64]byte
|
||||
copy(wideBytes[:], x[:])
|
||||
wideBytes[0] &= 248
|
||||
wideBytes[31] &= 63
|
||||
wideBytes[31] |= 64
|
||||
return s.SetUniformBytes(wideBytes[:])
|
||||
}
|
||||
|
||||
// Bytes returns the canonical 32-byte little-endian encoding of s.
|
||||
func (s *Scalar) Bytes() []byte {
|
||||
// This function is outlined to make the allocations inline in the caller
|
||||
// rather than happen on the heap.
|
||||
var encoded [32]byte
|
||||
return s.bytes(&encoded)
|
||||
}
|
||||
|
||||
func (s *Scalar) bytes(out *[32]byte) []byte {
|
||||
var ss fiatScalarNonMontgomeryDomainFieldElement
|
||||
fiatScalarFromMontgomery(&ss, &s.s)
|
||||
fiatScalarToBytes(out, (*[4]uint64)(&ss))
|
||||
return out[:]
|
||||
}
|
||||
|
||||
// Equal returns 1 if s and t are equal, and 0 otherwise.
|
||||
func (s *Scalar) Equal(t *Scalar) int {
|
||||
var diff fiatScalarMontgomeryDomainFieldElement
|
||||
fiatScalarSub(&diff, &s.s, &t.s)
|
||||
var nonzero uint64
|
||||
fiatScalarNonzero(&nonzero, (*[4]uint64)(&diff))
|
||||
nonzero |= nonzero >> 32
|
||||
nonzero |= nonzero >> 16
|
||||
nonzero |= nonzero >> 8
|
||||
nonzero |= nonzero >> 4
|
||||
nonzero |= nonzero >> 2
|
||||
nonzero |= nonzero >> 1
|
||||
return int(^nonzero) & 1
|
||||
}
|
||||
|
||||
// nonAdjacentForm computes a width-w non-adjacent form for this scalar.
|
||||
//
|
||||
// w must be between 2 and 8, or nonAdjacentForm will panic.
|
||||
func (s *Scalar) nonAdjacentForm(w uint) [256]int8 {
|
||||
// This implementation is adapted from the one
|
||||
// in curve25519-dalek and is documented there:
|
||||
// https://github.com/dalek-cryptography/curve25519-dalek/blob/f630041af28e9a405255f98a8a93adca18e4315b/src/scalar.rs#L800-L871
|
||||
b := s.Bytes()
|
||||
if b[31] > 127 {
|
||||
panic("scalar has high bit set illegally")
|
||||
}
|
||||
if w < 2 {
|
||||
panic("w must be at least 2 by the definition of NAF")
|
||||
} else if w > 8 {
|
||||
panic("NAF digits must fit in int8")
|
||||
}
|
||||
|
||||
var naf [256]int8
|
||||
var digits [5]uint64
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
digits[i] = binary.LittleEndian.Uint64(b[i*8:])
|
||||
}
|
||||
|
||||
width := uint64(1 << w)
|
||||
windowMask := uint64(width - 1)
|
||||
|
||||
pos := uint(0)
|
||||
carry := uint64(0)
|
||||
for pos < 256 {
|
||||
indexU64 := pos / 64
|
||||
indexBit := pos % 64
|
||||
var bitBuf uint64
|
||||
if indexBit < 64-w {
|
||||
// This window's bits are contained in a single u64
|
||||
bitBuf = digits[indexU64] >> indexBit
|
||||
} else {
|
||||
// Combine the current 64 bits with bits from the next 64
|
||||
bitBuf = (digits[indexU64] >> indexBit) | (digits[1+indexU64] << (64 - indexBit))
|
||||
}
|
||||
|
||||
// Add carry into the current window
|
||||
window := carry + (bitBuf & windowMask)
|
||||
|
||||
if window&1 == 0 {
|
||||
// If the window value is even, preserve the carry and continue.
|
||||
// Why is the carry preserved?
|
||||
// If carry == 0 and window & 1 == 0,
|
||||
// then the next carry should be 0
|
||||
// If carry == 1 and window & 1 == 0,
|
||||
// then bit_buf & 1 == 1 so the next carry should be 1
|
||||
pos += 1
|
||||
continue
|
||||
}
|
||||
|
||||
if window < width/2 {
|
||||
carry = 0
|
||||
naf[pos] = int8(window)
|
||||
} else {
|
||||
carry = 1
|
||||
naf[pos] = int8(window) - int8(width)
|
||||
}
|
||||
|
||||
pos += w
|
||||
}
|
||||
return naf
|
||||
}
|
||||
|
||||
func (s *Scalar) signedRadix16() [64]int8 {
|
||||
b := s.Bytes()
|
||||
if b[31] > 127 {
|
||||
panic("scalar has high bit set illegally")
|
||||
}
|
||||
|
||||
var digits [64]int8
|
||||
|
||||
// Compute unsigned radix-16 digits:
|
||||
for i := 0; i < 32; i++ {
|
||||
digits[2*i] = int8(b[i] & 15)
|
||||
digits[2*i+1] = int8((b[i] >> 4) & 15)
|
||||
}
|
||||
|
||||
// Recenter coefficients:
|
||||
for i := 0; i < 63; i++ {
|
||||
carry := (digits[i] + 8) >> 4
|
||||
digits[i] -= carry << 4
|
||||
digits[i+1] += carry
|
||||
}
|
||||
|
||||
return digits
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,214 @@
|
||||
// Copyright (c) 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package edwards25519
|
||||
|
||||
import "sync"
|
||||
|
||||
// basepointTable is a set of 32 affineLookupTables, where table i is generated
|
||||
// from 256i * basepoint. It is precomputed the first time it's used.
|
||||
func basepointTable() *[32]affineLookupTable {
|
||||
basepointTablePrecomp.initOnce.Do(func() {
|
||||
p := NewGeneratorPoint()
|
||||
for i := 0; i < 32; i++ {
|
||||
basepointTablePrecomp.table[i].FromP3(p)
|
||||
for j := 0; j < 8; j++ {
|
||||
p.Add(p, p)
|
||||
}
|
||||
}
|
||||
})
|
||||
return &basepointTablePrecomp.table
|
||||
}
|
||||
|
||||
var basepointTablePrecomp struct {
|
||||
table [32]affineLookupTable
|
||||
initOnce sync.Once
|
||||
}
|
||||
|
||||
// ScalarBaseMult sets v = x * B, where B is the canonical generator, and
|
||||
// returns v.
|
||||
//
|
||||
// The scalar multiplication is done in constant time.
|
||||
func (v *Point) ScalarBaseMult(x *Scalar) *Point {
|
||||
basepointTable := basepointTable()
|
||||
|
||||
// Write x = sum(x_i * 16^i) so x*B = sum( B*x_i*16^i )
|
||||
// as described in the Ed25519 paper
|
||||
//
|
||||
// Group even and odd coefficients
|
||||
// x*B = x_0*16^0*B + x_2*16^2*B + ... + x_62*16^62*B
|
||||
// + x_1*16^1*B + x_3*16^3*B + ... + x_63*16^63*B
|
||||
// x*B = x_0*16^0*B + x_2*16^2*B + ... + x_62*16^62*B
|
||||
// + 16*( x_1*16^0*B + x_3*16^2*B + ... + x_63*16^62*B)
|
||||
//
|
||||
// We use a lookup table for each i to get x_i*16^(2*i)*B
|
||||
// and do four doublings to multiply by 16.
|
||||
digits := x.signedRadix16()
|
||||
|
||||
multiple := &affineCached{}
|
||||
tmp1 := &projP1xP1{}
|
||||
tmp2 := &projP2{}
|
||||
|
||||
// Accumulate the odd components first
|
||||
v.Set(NewIdentityPoint())
|
||||
for i := 1; i < 64; i += 2 {
|
||||
basepointTable[i/2].SelectInto(multiple, digits[i])
|
||||
tmp1.AddAffine(v, multiple)
|
||||
v.fromP1xP1(tmp1)
|
||||
}
|
||||
|
||||
// Multiply by 16
|
||||
tmp2.FromP3(v) // tmp2 = v in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 2*v in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 2*v in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 4*v in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 4*v in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 8*v in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 8*v in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 16*v in P1xP1 coords
|
||||
v.fromP1xP1(tmp1) // now v = 16*(odd components)
|
||||
|
||||
// Accumulate the even components
|
||||
for i := 0; i < 64; i += 2 {
|
||||
basepointTable[i/2].SelectInto(multiple, digits[i])
|
||||
tmp1.AddAffine(v, multiple)
|
||||
v.fromP1xP1(tmp1)
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// ScalarMult sets v = x * q, and returns v.
|
||||
//
|
||||
// The scalar multiplication is done in constant time.
|
||||
func (v *Point) ScalarMult(x *Scalar, q *Point) *Point {
|
||||
checkInitialized(q)
|
||||
|
||||
var table projLookupTable
|
||||
table.FromP3(q)
|
||||
|
||||
// Write x = sum(x_i * 16^i)
|
||||
// so x*Q = sum( Q*x_i*16^i )
|
||||
// = Q*x_0 + 16*(Q*x_1 + 16*( ... + Q*x_63) ... )
|
||||
// <------compute inside out---------
|
||||
//
|
||||
// We use the lookup table to get the x_i*Q values
|
||||
// and do four doublings to compute 16*Q
|
||||
digits := x.signedRadix16()
|
||||
|
||||
// Unwrap first loop iteration to save computing 16*identity
|
||||
multiple := &projCached{}
|
||||
tmp1 := &projP1xP1{}
|
||||
tmp2 := &projP2{}
|
||||
table.SelectInto(multiple, digits[63])
|
||||
|
||||
v.Set(NewIdentityPoint())
|
||||
tmp1.Add(v, multiple) // tmp1 = x_63*Q in P1xP1 coords
|
||||
for i := 62; i >= 0; i-- {
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = (prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 2*(prev) in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 2*(prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 4*(prev) in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 4*(prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 8*(prev) in P1xP1 coords
|
||||
tmp2.FromP1xP1(tmp1) // tmp2 = 8*(prev) in P2 coords
|
||||
tmp1.Double(tmp2) // tmp1 = 16*(prev) in P1xP1 coords
|
||||
v.fromP1xP1(tmp1) // v = 16*(prev) in P3 coords
|
||||
table.SelectInto(multiple, digits[i])
|
||||
tmp1.Add(v, multiple) // tmp1 = x_i*Q + 16*(prev) in P1xP1 coords
|
||||
}
|
||||
v.fromP1xP1(tmp1)
|
||||
return v
|
||||
}
|
||||
|
||||
// basepointNafTable is the nafLookupTable8 for the basepoint.
|
||||
// It is precomputed the first time it's used.
|
||||
func basepointNafTable() *nafLookupTable8 {
|
||||
basepointNafTablePrecomp.initOnce.Do(func() {
|
||||
basepointNafTablePrecomp.table.FromP3(NewGeneratorPoint())
|
||||
})
|
||||
return &basepointNafTablePrecomp.table
|
||||
}
|
||||
|
||||
var basepointNafTablePrecomp struct {
|
||||
table nafLookupTable8
|
||||
initOnce sync.Once
|
||||
}
|
||||
|
||||
// VarTimeDoubleScalarBaseMult sets v = a * A + b * B, where B is the canonical
|
||||
// generator, and returns v.
|
||||
//
|
||||
// Execution time depends on the inputs.
|
||||
func (v *Point) VarTimeDoubleScalarBaseMult(a *Scalar, A *Point, b *Scalar) *Point {
|
||||
checkInitialized(A)
|
||||
|
||||
// Similarly to the single variable-base approach, we compute
|
||||
// digits and use them with a lookup table. However, because
|
||||
// we are allowed to do variable-time operations, we don't
|
||||
// need constant-time lookups or constant-time digit
|
||||
// computations.
|
||||
//
|
||||
// So we use a non-adjacent form of some width w instead of
|
||||
// radix 16. This is like a binary representation (one digit
|
||||
// for each binary place) but we allow the digits to grow in
|
||||
// magnitude up to 2^{w-1} so that the nonzero digits are as
|
||||
// sparse as possible. Intuitively, this "condenses" the
|
||||
// "mass" of the scalar onto sparse coefficients (meaning
|
||||
// fewer additions).
|
||||
|
||||
basepointNafTable := basepointNafTable()
|
||||
var aTable nafLookupTable5
|
||||
aTable.FromP3(A)
|
||||
// Because the basepoint is fixed, we can use a wider NAF
|
||||
// corresponding to a bigger table.
|
||||
aNaf := a.nonAdjacentForm(5)
|
||||
bNaf := b.nonAdjacentForm(8)
|
||||
|
||||
// Find the first nonzero coefficient.
|
||||
i := 255
|
||||
for j := i; j >= 0; j-- {
|
||||
if aNaf[j] != 0 || bNaf[j] != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
multA := &projCached{}
|
||||
multB := &affineCached{}
|
||||
tmp1 := &projP1xP1{}
|
||||
tmp2 := &projP2{}
|
||||
tmp2.Zero()
|
||||
|
||||
// Move from high to low bits, doubling the accumulator
|
||||
// at each iteration and checking whether there is a nonzero
|
||||
// coefficient to look up a multiple of.
|
||||
for ; i >= 0; i-- {
|
||||
tmp1.Double(tmp2)
|
||||
|
||||
// Only update v if we have a nonzero coeff to add in.
|
||||
if aNaf[i] > 0 {
|
||||
v.fromP1xP1(tmp1)
|
||||
aTable.SelectInto(multA, aNaf[i])
|
||||
tmp1.Add(v, multA)
|
||||
} else if aNaf[i] < 0 {
|
||||
v.fromP1xP1(tmp1)
|
||||
aTable.SelectInto(multA, -aNaf[i])
|
||||
tmp1.Sub(v, multA)
|
||||
}
|
||||
|
||||
if bNaf[i] > 0 {
|
||||
v.fromP1xP1(tmp1)
|
||||
basepointNafTable.SelectInto(multB, bNaf[i])
|
||||
tmp1.AddAffine(v, multB)
|
||||
} else if bNaf[i] < 0 {
|
||||
v.fromP1xP1(tmp1)
|
||||
basepointNafTable.SelectInto(multB, -bNaf[i])
|
||||
tmp1.SubAffine(v, multB)
|
||||
}
|
||||
|
||||
tmp2.FromP1xP1(tmp1)
|
||||
}
|
||||
|
||||
v.fromP2(tmp2)
|
||||
return v
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
// Copyright (c) 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package edwards25519
|
||||
|
||||
import (
|
||||
"crypto/subtle"
|
||||
)
|
||||
|
||||
// A dynamic lookup table for variable-base, constant-time scalar muls.
|
||||
type projLookupTable struct {
|
||||
points [8]projCached
|
||||
}
|
||||
|
||||
// A precomputed lookup table for fixed-base, constant-time scalar muls.
|
||||
type affineLookupTable struct {
|
||||
points [8]affineCached
|
||||
}
|
||||
|
||||
// A dynamic lookup table for variable-base, variable-time scalar muls.
|
||||
type nafLookupTable5 struct {
|
||||
points [8]projCached
|
||||
}
|
||||
|
||||
// A precomputed lookup table for fixed-base, variable-time scalar muls.
|
||||
type nafLookupTable8 struct {
|
||||
points [64]affineCached
|
||||
}
|
||||
|
||||
// Constructors.
|
||||
|
||||
// Builds a lookup table at runtime. Fast.
|
||||
func (v *projLookupTable) FromP3(q *Point) {
|
||||
// Goal: v.points[i] = (i+1)*Q, i.e., Q, 2Q, ..., 8Q
|
||||
// This allows lookup of -8Q, ..., -Q, 0, Q, ..., 8Q
|
||||
v.points[0].FromP3(q)
|
||||
tmpP3 := Point{}
|
||||
tmpP1xP1 := projP1xP1{}
|
||||
for i := 0; i < 7; i++ {
|
||||
// Compute (i+1)*Q as Q + i*Q and convert to a projCached
|
||||
// This is needlessly complicated because the API has explicit
|
||||
// receivers instead of creating stack objects and relying on RVO
|
||||
v.points[i+1].FromP3(tmpP3.fromP1xP1(tmpP1xP1.Add(q, &v.points[i])))
|
||||
}
|
||||
}
|
||||
|
||||
// This is not optimised for speed; fixed-base tables should be precomputed.
|
||||
func (v *affineLookupTable) FromP3(q *Point) {
|
||||
// Goal: v.points[i] = (i+1)*Q, i.e., Q, 2Q, ..., 8Q
|
||||
// This allows lookup of -8Q, ..., -Q, 0, Q, ..., 8Q
|
||||
v.points[0].FromP3(q)
|
||||
tmpP3 := Point{}
|
||||
tmpP1xP1 := projP1xP1{}
|
||||
for i := 0; i < 7; i++ {
|
||||
// Compute (i+1)*Q as Q + i*Q and convert to affineCached
|
||||
v.points[i+1].FromP3(tmpP3.fromP1xP1(tmpP1xP1.AddAffine(q, &v.points[i])))
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a lookup table at runtime. Fast.
|
||||
func (v *nafLookupTable5) FromP3(q *Point) {
|
||||
// Goal: v.points[i] = (2*i+1)*Q, i.e., Q, 3Q, 5Q, ..., 15Q
|
||||
// This allows lookup of -15Q, ..., -3Q, -Q, 0, Q, 3Q, ..., 15Q
|
||||
v.points[0].FromP3(q)
|
||||
q2 := Point{}
|
||||
q2.Add(q, q)
|
||||
tmpP3 := Point{}
|
||||
tmpP1xP1 := projP1xP1{}
|
||||
for i := 0; i < 7; i++ {
|
||||
v.points[i+1].FromP3(tmpP3.fromP1xP1(tmpP1xP1.Add(&q2, &v.points[i])))
|
||||
}
|
||||
}
|
||||
|
||||
// This is not optimised for speed; fixed-base tables should be precomputed.
|
||||
func (v *nafLookupTable8) FromP3(q *Point) {
|
||||
v.points[0].FromP3(q)
|
||||
q2 := Point{}
|
||||
q2.Add(q, q)
|
||||
tmpP3 := Point{}
|
||||
tmpP1xP1 := projP1xP1{}
|
||||
for i := 0; i < 63; i++ {
|
||||
v.points[i+1].FromP3(tmpP3.fromP1xP1(tmpP1xP1.AddAffine(&q2, &v.points[i])))
|
||||
}
|
||||
}
|
||||
|
||||
// Selectors.
|
||||
|
||||
// Set dest to x*Q, where -8 <= x <= 8, in constant time.
|
||||
func (v *projLookupTable) SelectInto(dest *projCached, x int8) {
|
||||
// Compute xabs = |x|
|
||||
xmask := x >> 7
|
||||
xabs := uint8((x + xmask) ^ xmask)
|
||||
|
||||
dest.Zero()
|
||||
for j := 1; j <= 8; j++ {
|
||||
// Set dest = j*Q if |x| = j
|
||||
cond := subtle.ConstantTimeByteEq(xabs, uint8(j))
|
||||
dest.Select(&v.points[j-1], dest, cond)
|
||||
}
|
||||
// Now dest = |x|*Q, conditionally negate to get x*Q
|
||||
dest.CondNeg(int(xmask & 1))
|
||||
}
|
||||
|
||||
// Set dest to x*Q, where -8 <= x <= 8, in constant time.
|
||||
func (v *affineLookupTable) SelectInto(dest *affineCached, x int8) {
|
||||
// Compute xabs = |x|
|
||||
xmask := x >> 7
|
||||
xabs := uint8((x + xmask) ^ xmask)
|
||||
|
||||
dest.Zero()
|
||||
for j := 1; j <= 8; j++ {
|
||||
// Set dest = j*Q if |x| = j
|
||||
cond := subtle.ConstantTimeByteEq(xabs, uint8(j))
|
||||
dest.Select(&v.points[j-1], dest, cond)
|
||||
}
|
||||
// Now dest = |x|*Q, conditionally negate to get x*Q
|
||||
dest.CondNeg(int(xmask & 1))
|
||||
}
|
||||
|
||||
// Given odd x with 0 < x < 2^4, return x*Q (in variable time).
|
||||
func (v *nafLookupTable5) SelectInto(dest *projCached, x int8) {
|
||||
*dest = v.points[x/2]
|
||||
}
|
||||
|
||||
// Given odd x with 0 < x < 2^7, return x*Q (in variable time).
|
||||
func (v *nafLookupTable8) SelectInto(dest *affineCached, x int8) {
|
||||
*dest = v.points[x/2]
|
||||
}
|
@ -1,124 +1,105 @@
|
||||
// +build !amd64 !go1.16 go1.22
|
||||
// +build !amd64,!arm64 go1.23 !go1.16 arm64,!go1.20
|
||||
|
||||
/*
|
||||
* Copyright 2022 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright 2022 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
`encoding/base64`
|
||||
`encoding/json`
|
||||
`fmt`
|
||||
`encoding/json`
|
||||
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
`github.com/bytedance/sonic/internal/rt`
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
`github.com/bytedance/sonic/internal/rt`
|
||||
)
|
||||
|
||||
func init() {
|
||||
println("WARNING: sonic only supports Go1.16~1.20 && CPU amd64, but your environment is not suitable")
|
||||
println("WARNING:(ast) sonic only supports Go1.16~1.22, but your environment is not suitable")
|
||||
}
|
||||
|
||||
func quote(buf *[]byte, val string) {
|
||||
quoteString(buf, val)
|
||||
quoteString(buf, val)
|
||||
}
|
||||
|
||||
func unquote(src string) (string, types.ParsingError) {
|
||||
sp := rt.IndexChar(src, -1)
|
||||
out, ok := unquoteBytes(rt.BytesFrom(sp, len(src)+2, len(src)+2))
|
||||
if !ok {
|
||||
return "", types.ERR_INVALID_ESCAPE
|
||||
}
|
||||
return rt.Mem2Str(out), 0
|
||||
}
|
||||
|
||||
func decodeBase64(src string) ([]byte, error) {
|
||||
return base64.StdEncoding.DecodeString(src)
|
||||
sp := rt.IndexChar(src, -1)
|
||||
out, ok := unquoteBytes(rt.BytesFrom(sp, len(src)+2, len(src)+2))
|
||||
if !ok {
|
||||
return "", types.ERR_INVALID_ESCAPE
|
||||
}
|
||||
return rt.Mem2Str(out), 0
|
||||
}
|
||||
|
||||
func encodeBase64(src []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(src)
|
||||
}
|
||||
|
||||
func (self *Parser) decodeValue() (val types.JsonState) {
|
||||
e, v := decodeValue(self.s, self.p, self.dbuf == nil)
|
||||
if e < 0 {
|
||||
return v
|
||||
}
|
||||
self.p = e
|
||||
return v
|
||||
e, v := decodeValue(self.s, self.p, self.dbuf == nil)
|
||||
if e < 0 {
|
||||
return v
|
||||
}
|
||||
self.p = e
|
||||
return v
|
||||
}
|
||||
|
||||
func (self *Parser) skip() (int, types.ParsingError) {
|
||||
e, s := skipValue(self.s, self.p)
|
||||
if e < 0 {
|
||||
return self.p, types.ParsingError(-e)
|
||||
}
|
||||
self.p = e
|
||||
return s, 0
|
||||
e, s := skipValue(self.s, self.p)
|
||||
if e < 0 {
|
||||
return self.p, types.ParsingError(-e)
|
||||
}
|
||||
self.p = e
|
||||
return s, 0
|
||||
}
|
||||
|
||||
func (self *Parser) skipFast() (int, types.ParsingError) {
|
||||
e, s := skipValueFast(self.s, self.p)
|
||||
if e < 0 {
|
||||
return self.p, types.ParsingError(-e)
|
||||
}
|
||||
self.p = e
|
||||
return s, 0
|
||||
e, s := skipValueFast(self.s, self.p)
|
||||
if e < 0 {
|
||||
return self.p, types.ParsingError(-e)
|
||||
}
|
||||
self.p = e
|
||||
return s, 0
|
||||
}
|
||||
|
||||
func (self *Node) encodeInterface(buf *[]byte) error {
|
||||
out, err := json.Marshal(self.packAny())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*buf = append(*buf, out...)
|
||||
return nil
|
||||
out, err := json.Marshal(self.packAny())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*buf = append(*buf, out...)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *Searcher) GetByPath(path ...interface{}) (Node, error) {
|
||||
self.parser.p = 0
|
||||
|
||||
var err types.ParsingError
|
||||
func (self *Parser) getByPath(path ...interface{}) (int, types.ParsingError) {
|
||||
for _, p := range path {
|
||||
if idx, ok := p.(int); ok && idx >= 0 {
|
||||
if err = self.parser.searchIndex(idx); err != 0 {
|
||||
return Node{}, self.parser.ExportError(err)
|
||||
if err := self.searchIndex(idx); err != 0 {
|
||||
return self.p, err
|
||||
}
|
||||
} else if key, ok := p.(string); ok {
|
||||
if err = self.parser.searchKey(key); err != 0 {
|
||||
return Node{}, self.parser.ExportError(err)
|
||||
if err := self.searchKey(key); err != 0 {
|
||||
return self.p, err
|
||||
}
|
||||
} else {
|
||||
panic("path must be either int(>=0) or string")
|
||||
}
|
||||
}
|
||||
|
||||
var start = self.parser.p
|
||||
if start, err = self.parser.skip(); err != 0 {
|
||||
return Node{}, self.parser.ExportError(err)
|
||||
}
|
||||
ns := len(self.parser.s)
|
||||
if self.parser.p > ns || start >= ns || start>=self.parser.p {
|
||||
return Node{}, fmt.Errorf("skip %d char out of json boundary", start)
|
||||
start, e := self.skip()
|
||||
if e != 0 {
|
||||
return self.p, e
|
||||
}
|
||||
|
||||
t := switchRawType(self.parser.s[start])
|
||||
if t == _V_NONE {
|
||||
return Node{}, self.parser.ExportError(err)
|
||||
}
|
||||
|
||||
return newRawNode(self.parser.s[start:self.parser.p], t), nil
|
||||
}
|
||||
// t := switchRawType(self.s[start])
|
||||
// if t == _V_NUMBER {
|
||||
// self.p = 1 + backward(self.s, self.p-1)
|
||||
// }
|
||||
return start, 0
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
// +build amd64,go1.16
|
||||
|
||||
/**
|
||||
* Copyright 2023 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
`github.com/chenzhuoyu/base64x`
|
||||
)
|
||||
|
||||
func decodeBase64(src string) ([]byte, error) {
|
||||
return base64x.StdEncoding.DecodeString(src)
|
||||
}
|
||||
|
||||
func encodeBase64(src []byte) string {
|
||||
return base64x.StdEncoding.EncodeToString(src)
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
// +build !amd64 !go1.16
|
||||
|
||||
/*
|
||||
* Copyright 2022 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ast
|
||||
|
||||
import (
|
||||
`encoding/base64`
|
||||
)
|
||||
|
||||
func decodeBase64(src string) ([]byte, error) {
|
||||
return base64.StdEncoding.DecodeString(src)
|
||||
}
|
||||
|
||||
func encodeBase64(src []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(src)
|
||||
}
|
File diff suppressed because it is too large
Load Diff
28564
vendor/github.com/bytedance/sonic/internal/native/avx2/native_text_amd64.go
generated
vendored
28564
vendor/github.com/bytedance/sonic/internal/native/avx2/native_text_amd64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package native
|
||||
|
||||
import (
|
||||
`unsafe`
|
||||
|
||||
neon `github.com/bytedance/sonic/internal/native/neon`
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
const (
|
||||
MaxFrameSize uintptr = 200
|
||||
BufPaddingSize int = 64
|
||||
)
|
||||
|
||||
var (
|
||||
S_f64toa uintptr
|
||||
S_f32toa uintptr
|
||||
S_i64toa uintptr
|
||||
S_u64toa uintptr
|
||||
S_lspace uintptr
|
||||
)
|
||||
|
||||
var (
|
||||
S_quote uintptr
|
||||
S_unquote uintptr
|
||||
)
|
||||
|
||||
var (
|
||||
S_value uintptr
|
||||
S_vstring uintptr
|
||||
S_vnumber uintptr
|
||||
S_vsigned uintptr
|
||||
S_vunsigned uintptr
|
||||
)
|
||||
|
||||
var (
|
||||
S_skip_one uintptr
|
||||
S_skip_one_fast uintptr
|
||||
S_get_by_path uintptr
|
||||
S_skip_array uintptr
|
||||
S_skip_object uintptr
|
||||
S_skip_number uintptr
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname Quote github.com/bytedance/sonic/internal/native/neon.__quote
|
||||
func Quote(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname Unquote github.com/bytedance/sonic/internal/native/neon.__unquote
|
||||
func Unquote(s unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname HTMLEscape github.com/bytedance/sonic/internal/native/neon.__html_escape
|
||||
func HTMLEscape(s unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname Value github.com/bytedance/sonic/internal/native/neon.__value
|
||||
func Value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname SkipOne github.com/bytedance/sonic/internal/native/neon.__skip_one
|
||||
func SkipOne(s *string, p *int, m *types.StateMachine, flags uint64) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname SkipOneFast github.com/bytedance/sonic/internal/native/neon.__skip_one_fast
|
||||
func SkipOneFast(s *string, p *int) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname GetByPath github.com/bytedance/sonic/internal/native/neon.__get_by_path
|
||||
func GetByPath(s *string, p *int, path *[]interface{}, m *types.StateMachine) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname ValidateOne github.com/bytedance/sonic/internal/native/neon.__validate_one
|
||||
func ValidateOne(s *string, p *int, m *types.StateMachine) int
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname I64toa github.com/bytedance/sonic/internal/native/neon.__i64toa
|
||||
func I64toa(out *byte, val int64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname U64toa github.com/bytedance/sonic/internal/native/neon.__u64toa
|
||||
func U64toa(out *byte, val uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname F64toa github.com/bytedance/sonic/internal/native/neon.__f64toa
|
||||
func F64toa(out *byte, val float64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname F32toa github.com/bytedance/sonic/internal/native/neon.__f32toa
|
||||
func F32toa(out *byte, val float32) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname ValidateUTF8 github.com/bytedance/sonic/internal/native/neon.__validate_utf8
|
||||
func ValidateUTF8(s *string, p *int, m *types.StateMachine) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//go:linkname ValidateUTF8Fast github.com/bytedance/sonic/internal/native/neon.__validate_utf8_fast
|
||||
func ValidateUTF8Fast(s *string) (ret int)
|
||||
|
||||
func useNeon() {
|
||||
S_f64toa = neon.S_f64toa
|
||||
S_f32toa = neon.S_f32toa
|
||||
S_i64toa = neon.S_i64toa
|
||||
S_u64toa = neon.S_u64toa
|
||||
S_lspace = neon.S_lspace
|
||||
S_quote = neon.S_quote
|
||||
S_unquote = neon.S_unquote
|
||||
S_value = neon.S_value
|
||||
S_vstring = neon.S_vstring
|
||||
S_vnumber = neon.S_vnumber
|
||||
S_vsigned = neon.S_vsigned
|
||||
S_vunsigned = neon.S_vunsigned
|
||||
S_skip_one = neon.S_skip_one
|
||||
S_skip_one_fast = neon.S_skip_one_fast
|
||||
S_skip_array = neon.S_skip_array
|
||||
S_skip_object = neon.S_skip_object
|
||||
S_skip_number = neon.S_skip_number
|
||||
S_get_by_path = neon.S_get_by_path
|
||||
}
|
||||
|
||||
func init() {
|
||||
useNeon()
|
||||
}
|
@ -0,0 +1,246 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package {{PACKAGE}}
|
||||
|
||||
import (
|
||||
`unsafe`
|
||||
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
|
||||
//go:nosplit
|
||||
func i64toa(out *byte, val int64) (ret int) {
|
||||
return __i64toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func u64toa(out *byte, val uint64) (ret int) {
|
||||
return __u64toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func f64toa(out *byte, val float64) (ret int) {
|
||||
return __f64toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func f32toa(out *byte, val float32) (ret int) {
|
||||
return __f32toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func lspace(sp unsafe.Pointer, nb int, off int) (ret int) {
|
||||
return __lspace(sp, nb, off)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func quote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) (ret int) {
|
||||
return __quote(sp, nb, dp, dn, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int) {
|
||||
return __html_escape(sp, nb, dp, dn)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func unquote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) (ret int) {
|
||||
return __unquote(sp, nb, dp, ep, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) (ret int) {
|
||||
return __value(s, n, p, v, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func vstring(s *string, p *int, v *types.JsonState, flags uint64) {
|
||||
__vstring(s, p, v, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func vnumber(s *string, p *int, v *types.JsonState) {
|
||||
__vnumber(s, p, v)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func vsigned(s *string, p *int, v *types.JsonState) {
|
||||
__vsigned(s, p, v)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func vunsigned(s *string, p *int, v *types.JsonState) {
|
||||
__vunsigned(s, p, v)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func skip_one(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) {
|
||||
return __skip_one(s, p, m, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func skip_one_fast(s *string, p *int) (ret int) {
|
||||
return __skip_one_fast(s, p)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func skip_array(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) {
|
||||
return __skip_array(s, p, m, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func skip_object(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) {
|
||||
return __skip_object(s, p, m, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func skip_number(s *string, p *int) (ret int) {
|
||||
return __skip_number(s, p)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func validate_one(s *string, p *int, m *types.StateMachine) (ret int) {
|
||||
return __validate_one(s, p, m)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int) {
|
||||
return __get_by_path(s, p, path, m)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) {
|
||||
return __validate_utf8(s, p, m)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func validate_utf8_fast(s *string) (ret int) {
|
||||
return __validate_utf8_fast(s)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __i64toa(out *byte, val int64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __u64toa(out *byte, val uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __f64toa(out *byte, val float64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __f32toa(out *byte, val float32) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __lspace(sp unsafe.Pointer, nb int, off int) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __quote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __unquote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, ep *int, flags uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __vstring(s *string, p *int, v *types.JsonState, flags uint64)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __vnumber(s *string, p *int, v *types.JsonState)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __vsigned(s *string, p *int, v *types.JsonState)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __vunsigned(s *string, p *int, v *types.JsonState)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_one(s *string, p *int, m *types.StateMachine, flags uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_one_fast(s *string, p *int) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_array(s *string, p *int, m *types.StateMachine, flags uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_object(s *string, p *int, m *types.StateMachine, flags uint64) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_number(s *string, p *int) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __validate_one(s *string, p *int, m *types.StateMachine) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __validate_utf8_fast(s *string) (ret int)
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package {{PACKAGE}}
|
||||
|
||||
var (
|
||||
S_f64toa = _subr__f64toa
|
||||
S_f32toa = _subr__f32toa
|
||||
S_i64toa = _subr__i64toa
|
||||
S_u64toa = _subr__u64toa
|
||||
S_lspace = _subr__lspace
|
||||
)
|
||||
|
||||
var (
|
||||
S_quote = _subr__quote
|
||||
S_unquote = _subr__unquote
|
||||
)
|
||||
|
||||
var (
|
||||
S_value = _subr__value
|
||||
S_vstring = _subr__vstring
|
||||
S_vnumber = _subr__vnumber
|
||||
S_vsigned = _subr__vsigned
|
||||
S_vunsigned = _subr__vunsigned
|
||||
)
|
||||
|
||||
var (
|
||||
S_skip_one = _subr__skip_one
|
||||
S_skip_one_fast = _subr__skip_one_fast
|
||||
S_skip_array = _subr__skip_array
|
||||
S_skip_object = _subr__skip_object
|
||||
S_skip_number = _subr__skip_number
|
||||
S_get_by_path = _subr__get_by_path
|
||||
)
|
@ -0,0 +1,31 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
func f32toa(out *byte, val float32) (ret int) {
|
||||
return __f32toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __f32toa(out *byte, val float32) (ret int)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __f32toa_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__f32toa uintptr = __f32toa_entry__() + 0
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__f32toa = 32
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__f32toa
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__f32toa
|
||||
)
|
@ -0,0 +1,31 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
func f64toa(out *byte, val float64) (ret int) {
|
||||
return __f64toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __f64toa(out *byte, val float64) (ret int)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __f64toa_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__f64toa uintptr = __f64toa_entry__() + 0
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__f64toa = 32
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__f64toa
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__f64toa
|
||||
)
|
@ -0,0 +1,35 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
import (
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
func get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int) {
|
||||
return __get_by_path(s, p, path, m)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int)
|
File diff suppressed because it is too large
Load Diff
25
vendor/github.com/bytedance/sonic/internal/native/neon/get_by_path_subr_arm64.go
generated
vendored
25
vendor/github.com/bytedance/sonic/internal/native/neon/get_by_path_subr_arm64.go
generated
vendored
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __get_by_path_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__get_by_path uintptr = __get_by_path_entry__() + 48
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__get_by_path = 208
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__get_by_path
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__get_by_path
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
import (
|
||||
`unsafe`
|
||||
|
||||
// `github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
func html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int) {
|
||||
return __html_escape(sp, nb, dp, dn)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int)
|
File diff suppressed because it is too large
Load Diff
25
vendor/github.com/bytedance/sonic/internal/native/neon/html_escape_subr_arm64.go
generated
vendored
25
vendor/github.com/bytedance/sonic/internal/native/neon/html_escape_subr_arm64.go
generated
vendored
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __html_escape_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__html_escape uintptr = __html_escape_entry__() + 32
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__html_escape = 32
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__html_escape
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__html_escape
|
||||
)
|
@ -0,0 +1,31 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
func i64toa(out *byte, val int64) (ret int) {
|
||||
return __i64toa(out, val)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __i64toa(out *byte, val int64) (ret int)
|
@ -0,0 +1,985 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
#include "go_asm.h"
|
||||
#include "funcdata.h"
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·__i64toa_entry__(SB), NOSPLIT, $16
|
||||
NO_LOCAL_POINTERS
|
||||
WORD $0x100000a0 // adr x0, .+20
|
||||
MOVD R0, ret(FP)
|
||||
RET
|
||||
// .p2align 3, 0x00
|
||||
lCPI0_0:
|
||||
WORD $0x147b20c5
|
||||
WORD $0x80003334
|
||||
// // .word 8389
|
||||
// .word 5243
|
||||
// .word 13108
|
||||
// .word 32768
|
||||
|
||||
lCPI0_1:
|
||||
WORD $0x08000080
|
||||
WORD $0x80002000
|
||||
// // .word 128
|
||||
// .word 2048
|
||||
// .word 8192
|
||||
// .word 32768
|
||||
|
||||
lCPI0_2:
|
||||
WORD $0x08040201
|
||||
WORD $0x80402010
|
||||
WORD $0x08040201
|
||||
WORD $0x80402010
|
||||
// // .byte 1
|
||||
// .byte 2
|
||||
// .byte 4
|
||||
// .byte 8
|
||||
// .byte 16
|
||||
// .byte 32
|
||||
// .byte 64
|
||||
// .byte 128
|
||||
// .byte 1
|
||||
// .byte 2
|
||||
// .byte 4
|
||||
// .byte 8
|
||||
// .byte 16
|
||||
// .byte 32
|
||||
// .byte 64
|
||||
// .byte 128
|
||||
|
||||
lCPI0_3:
|
||||
WORD $0x09010800
|
||||
WORD $0x0b030a02
|
||||
WORD $0x0d050c04
|
||||
WORD $0x0f070e06
|
||||
// // .byte 0
|
||||
// .byte 8
|
||||
// .byte 1
|
||||
// .byte 9
|
||||
// .byte 2
|
||||
// .byte 10
|
||||
// .byte 3
|
||||
// .byte 11
|
||||
// .byte 4
|
||||
// .byte 12
|
||||
// .byte 5
|
||||
// .byte 13
|
||||
// .byte 6
|
||||
// .byte 14
|
||||
// .byte 7
|
||||
// .byte 15
|
||||
|
||||
_i64toa:
|
||||
WORD $0xd10083ff // sub sp, sp, #32
|
||||
WORD $0xa900fbfd // stp fp, lr, [sp, #8]
|
||||
WORD $0xa93ffbfd // stp fp, lr, [sp, #-8]
|
||||
WORD $0xd10023fd // sub fp, sp, #8
|
||||
WORD $0xb7f80641 // tbnz x1, #63, LBB0_10 $200(%rip)
|
||||
WORD $0xd344fc28 // lsr x8, x1, #4
|
||||
WORD $0xf109c11f // cmp x8, #624
|
||||
WORD $0x540008e8 // b.hi LBB0_13 $284(%rip)
|
||||
WORD $0x53023c28 // ubfx w8, w1, #2, #14
|
||||
WORD $0x52828f69 // mov w9, #5243
|
||||
WORD $0x1b097d08 // mul w8, w8, w9
|
||||
WORD $0x53117d08 // lsr w8, w8, #17
|
||||
WORD $0xd37f7d09 // ubfiz x9, x8, #1, #32
|
||||
WORD $0x52800c8a // mov w10, #100
|
||||
WORD $0x1b0a8508 // msub w8, w8, w10, w1
|
||||
WORD $0x92403d08 // and x8, x8, #0xffff
|
||||
WORD $0xd37ff908 // lsl x8, x8, #1
|
||||
WORD $0x710fa03f // cmp w1, #1000
|
||||
WORD $0x540000e3 // b.lo LBB0_4 $28(%rip)
|
||||
Lloh0:
|
||||
WORD $0x100054ea // adr x10, _Digits $2716(%rip)
|
||||
Lloh1:
|
||||
WORD $0x9100014a // add x10, x10, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x3869694a // ldrb w10, [x10, x9]
|
||||
WORD $0x3900000a // strb w10, [x0]
|
||||
WORD $0x5280002a // mov w10, #1
|
||||
WORD $0x14000004 // b LBB0_6 $16(%rip)
|
||||
LBB0_4:
|
||||
WORD $0x7101903f // cmp w1, #100
|
||||
WORD $0x540002e3 // b.lo LBB0_9 $92(%rip)
|
||||
WORD $0x5280000a // mov w10, #0
|
||||
LBB0_6:
|
||||
Lloh2:
|
||||
WORD $0x100053cb // adr x11, _Digits $2680(%rip)
|
||||
Lloh3:
|
||||
WORD $0x9100016b // add x11, x11, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b294169 // add x9, x11, w9, uxtw
|
||||
WORD $0x3940052b // ldrb w11, [x9, #1]
|
||||
WORD $0x11000549 // add w9, w10, #1
|
||||
WORD $0x382a480b // strb w11, [x0, w10, uxtw]
|
||||
LBB0_7:
|
||||
Lloh4:
|
||||
WORD $0x1000530a // adr x10, _Digits $2656(%rip)
|
||||
Lloh5:
|
||||
WORD $0x9100014a // add x10, x10, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x3868694b // ldrb w11, [x10, x8]
|
||||
WORD $0x1100052a // add w10, w9, #1
|
||||
WORD $0x3829480b // strb w11, [x0, w9, uxtw]
|
||||
LBB0_8:
|
||||
Lloh6:
|
||||
WORD $0x10005269 // adr x9, _Digits $2636(%rip)
|
||||
Lloh7:
|
||||
WORD $0x91000129 // add x9, x9, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b282128 // add x8, x9, w8, uxth
|
||||
WORD $0x39400509 // ldrb w9, [x8, #1]
|
||||
WORD $0x11000548 // add w8, w10, #1
|
||||
WORD $0x382a4809 // strb w9, [x0, w10, uxtw]
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_9:
|
||||
WORD $0x52800009 // mov w9, #0
|
||||
WORD $0x5280000a // mov w10, #0
|
||||
WORD $0x7100283f // cmp w1, #10
|
||||
WORD $0x54fffdc2 // b.hs LBB0_7 $-72(%rip)
|
||||
WORD $0x17fffff2 // b LBB0_8 $-56(%rip)
|
||||
LBB0_10:
|
||||
WORD $0x528005a9 // mov w9, #45
|
||||
WORD $0xaa0003e8 // mov x8, x0
|
||||
WORD $0x38001509 // strb w9, [x8], #1
|
||||
WORD $0xcb0103e9 // neg x9, x1
|
||||
WORD $0xd344fd2a // lsr x10, x9, #4
|
||||
WORD $0xf109c15f // cmp x10, #624
|
||||
WORD $0x54001068 // b.hi LBB0_28 $524(%rip)
|
||||
WORD $0x53023d2a // ubfx w10, w9, #2, #14
|
||||
WORD $0x52828f6b // mov w11, #5243
|
||||
WORD $0x1b0b7d4a // mul w10, w10, w11
|
||||
WORD $0x53117d4a // lsr w10, w10, #17
|
||||
WORD $0xd37f7d4b // ubfiz x11, x10, #1, #32
|
||||
WORD $0x52800c8c // mov w12, #100
|
||||
WORD $0x1b0ca54a // msub w10, w10, w12, w9
|
||||
WORD $0x92403d4a // and x10, x10, #0xffff
|
||||
WORD $0xd37ff94a // lsl x10, x10, #1
|
||||
WORD $0x710fa13f // cmp w9, #1000
|
||||
WORD $0x540004e3 // b.lo LBB0_16 $156(%rip)
|
||||
Lloh8:
|
||||
WORD $0x10004e49 // adr x9, _Digits $2504(%rip)
|
||||
Lloh9:
|
||||
WORD $0x91000129 // add x9, x9, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x386b6929 // ldrb w9, [x9, x11]
|
||||
WORD $0x39000109 // strb w9, [x8]
|
||||
WORD $0x52800029 // mov w9, #1
|
||||
WORD $0x14000024 // b LBB0_18 $144(%rip)
|
||||
LBB0_13:
|
||||
WORD $0x529c2008 // mov w8, #57600
|
||||
WORD $0x72a0bea8 // movk w8, #1525, lsl #16
|
||||
WORD $0xeb08003f // cmp x1, x8
|
||||
WORD $0x540011c2 // b.hs LBB0_31 $568(%rip)
|
||||
WORD $0x5282eb28 // mov w8, #5977
|
||||
WORD $0x72ba36e8 // movk w8, #53687, lsl #16
|
||||
WORD $0x92407c29 // and x9, x1, #0xffffffff
|
||||
WORD $0x9ba87d28 // umull x8, w9, w8
|
||||
WORD $0xd36dfd08 // lsr x8, x8, #45
|
||||
WORD $0x529bd06a // mov w10, #56963
|
||||
WORD $0x72a8636a // movk w10, #17179, lsl #16
|
||||
WORD $0x9baa7d29 // umull x9, w9, w10
|
||||
WORD $0xd371fd29 // lsr x9, x9, #49
|
||||
WORD $0x927f312a // and x10, x9, #0x3ffe
|
||||
WORD $0x53023d09 // ubfx w9, w8, #2, #14
|
||||
WORD $0x52828f6b // mov w11, #5243
|
||||
WORD $0x1b0b7d29 // mul w9, w9, w11
|
||||
WORD $0x53117d29 // lsr w9, w9, #17
|
||||
WORD $0x52800c8b // mov w11, #100
|
||||
WORD $0x1b0ba129 // msub w9, w9, w11, w8
|
||||
WORD $0x92403d29 // and x9, x9, #0xffff
|
||||
WORD $0xd37ff929 // lsl x9, x9, #1
|
||||
WORD $0x5292cfeb // mov w11, #38527
|
||||
WORD $0x72a0130b // movk w11, #152, lsl #16
|
||||
WORD $0x6b0b003f // cmp w1, w11
|
||||
WORD $0x54000409 // b.ls LBB0_21 $128(%rip)
|
||||
Lloh10:
|
||||
WORD $0x10004a4b // adr x11, _Digits $2376(%rip)
|
||||
Lloh11:
|
||||
WORD $0x9100016b // add x11, x11, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x386a696b // ldrb w11, [x11, x10]
|
||||
WORD $0x3900000b // strb w11, [x0]
|
||||
WORD $0x5280002c // mov w12, #1
|
||||
WORD $0x1400001f // b LBB0_23 $124(%rip)
|
||||
LBB0_16:
|
||||
WORD $0x7101913f // cmp w9, #100
|
||||
WORD $0x540008a3 // b.lo LBB0_26 $276(%rip)
|
||||
WORD $0x52800009 // mov w9, #0
|
||||
LBB0_18:
|
||||
Lloh12:
|
||||
WORD $0x1000492c // adr x12, _Digits $2340(%rip)
|
||||
Lloh13:
|
||||
WORD $0x9100018c // add x12, x12, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b2b418b // add x11, x12, w11, uxtw
|
||||
WORD $0x3940056c // ldrb w12, [x11, #1]
|
||||
WORD $0x1100052b // add w11, w9, #1
|
||||
WORD $0x3829490c // strb w12, [x8, w9, uxtw]
|
||||
LBB0_19:
|
||||
Lloh14:
|
||||
WORD $0x10004869 // adr x9, _Digits $2316(%rip)
|
||||
Lloh15:
|
||||
WORD $0x91000129 // add x9, x9, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x386a6929 // ldrb w9, [x9, x10]
|
||||
WORD $0x1100056c // add w12, w11, #1
|
||||
WORD $0x382b4909 // strb w9, [x8, w11, uxtw]
|
||||
LBB0_20:
|
||||
Lloh16:
|
||||
WORD $0x100047c9 // adr x9, _Digits $2296(%rip)
|
||||
Lloh17:
|
||||
WORD $0x91000129 // add x9, x9, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b2a2129 // add x9, x9, w10, uxth
|
||||
WORD $0x3940052a // ldrb w10, [x9, #1]
|
||||
WORD $0x11000589 // add w9, w12, #1
|
||||
WORD $0x382c490a // strb w10, [x8, w12, uxtw]
|
||||
WORD $0x11000528 // add w8, w9, #1
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_21:
|
||||
WORD $0x528847eb // mov w11, #16959
|
||||
WORD $0x72a001eb // movk w11, #15, lsl #16
|
||||
WORD $0x6b0b003f // cmp w1, w11
|
||||
WORD $0x540005e9 // b.ls LBB0_27 $188(%rip)
|
||||
WORD $0x5280000c // mov w12, #0
|
||||
LBB0_23:
|
||||
Lloh18:
|
||||
WORD $0x100045cb // adr x11, _Digits $2232(%rip)
|
||||
Lloh19:
|
||||
WORD $0x9100016b // add x11, x11, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b2a416a // add x10, x11, w10, uxtw
|
||||
WORD $0x3940054a // ldrb w10, [x10, #1]
|
||||
WORD $0x1100058b // add w11, w12, #1
|
||||
WORD $0x382c480a // strb w10, [x0, w12, uxtw]
|
||||
LBB0_24:
|
||||
Lloh20:
|
||||
WORD $0x1000450a // adr x10, _Digits $2208(%rip)
|
||||
Lloh21:
|
||||
WORD $0x9100014a // add x10, x10, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x3869694c // ldrb w12, [x10, x9]
|
||||
WORD $0x1100056a // add w10, w11, #1
|
||||
WORD $0x382b480c // strb w12, [x0, w11, uxtw]
|
||||
LBB0_25:
|
||||
WORD $0x5284e20b // mov w11, #10000
|
||||
WORD $0x1b0b8508 // msub w8, w8, w11, w1
|
||||
WORD $0x53023d0b // ubfx w11, w8, #2, #14
|
||||
WORD $0x52828f6c // mov w12, #5243
|
||||
WORD $0x1b0c7d6b // mul w11, w11, w12
|
||||
WORD $0x53117d6b // lsr w11, w11, #17
|
||||
WORD $0x52800c8c // mov w12, #100
|
||||
WORD $0x1b0ca168 // msub w8, w11, w12, w8
|
||||
WORD $0x92403d08 // and x8, x8, #0xffff
|
||||
WORD $0xd37ff908 // lsl x8, x8, #1
|
||||
Lloh22:
|
||||
WORD $0x1000432c // adr x12, _Digits $2148(%rip)
|
||||
Lloh23:
|
||||
WORD $0x9100018c // add x12, x12, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b292189 // add x9, x12, w9, uxth
|
||||
WORD $0x39400529 // ldrb w9, [x9, #1]
|
||||
WORD $0x8b2a400d // add x13, x0, w10, uxtw
|
||||
WORD $0x390001a9 // strb w9, [x13]
|
||||
WORD $0x786b5989 // ldrh w9, [x12, w11, uxtw #1]
|
||||
WORD $0x780011a9 // sturh w9, [x13, #1]
|
||||
WORD $0x38686989 // ldrb w9, [x12, x8]
|
||||
WORD $0x39000da9 // strb w9, [x13, #3]
|
||||
WORD $0x927f3908 // and x8, x8, #0xfffe
|
||||
WORD $0x8b080188 // add x8, x12, x8
|
||||
WORD $0x39400509 // ldrb w9, [x8, #1]
|
||||
WORD $0x11001548 // add w8, w10, #5
|
||||
WORD $0x390011a9 // strb w9, [x13, #4]
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_26:
|
||||
WORD $0x5280000b // mov w11, #0
|
||||
WORD $0x5280000c // mov w12, #0
|
||||
WORD $0x7100293f // cmp w9, #10
|
||||
WORD $0x54fff802 // b.hs LBB0_19 $-256(%rip)
|
||||
WORD $0x17ffffc4 // b LBB0_20 $-240(%rip)
|
||||
LBB0_27:
|
||||
WORD $0x5280000b // mov w11, #0
|
||||
WORD $0x5280000a // mov w10, #0
|
||||
WORD $0x53057c2c // lsr w12, w1, #5
|
||||
WORD $0x7130d59f // cmp w12, #3125
|
||||
WORD $0x54fffaa2 // b.hs LBB0_24 $-172(%rip)
|
||||
WORD $0x17ffffd9 // b LBB0_25 $-156(%rip)
|
||||
LBB0_28:
|
||||
WORD $0x529c200a // mov w10, #57600
|
||||
WORD $0x72a0beaa // movk w10, #1525, lsl #16
|
||||
WORD $0xeb0a013f // cmp x9, x10
|
||||
WORD $0x54001662 // b.hs LBB0_39 $716(%rip)
|
||||
WORD $0x5282eb2a // mov w10, #5977
|
||||
WORD $0x72ba36ea // movk w10, #53687, lsl #16
|
||||
WORD $0x9baa7d2a // umull x10, w9, w10
|
||||
WORD $0xd36dfd4a // lsr x10, x10, #45
|
||||
WORD $0x529bd06b // mov w11, #56963
|
||||
WORD $0x72a8636b // movk w11, #17179, lsl #16
|
||||
WORD $0x92407d2c // and x12, x9, #0xffffffff
|
||||
WORD $0x9bab7d8b // umull x11, w12, w11
|
||||
WORD $0xd371fd6b // lsr x11, x11, #49
|
||||
WORD $0x927f316c // and x12, x11, #0x3ffe
|
||||
WORD $0x53023d4b // ubfx w11, w10, #2, #14
|
||||
WORD $0x52828f6d // mov w13, #5243
|
||||
WORD $0x1b0d7d6b // mul w11, w11, w13
|
||||
WORD $0x53117d6b // lsr w11, w11, #17
|
||||
WORD $0x52800c8d // mov w13, #100
|
||||
WORD $0x1b0da96b // msub w11, w11, w13, w10
|
||||
WORD $0x92403d6b // and x11, x11, #0xffff
|
||||
WORD $0xd37ff96b // lsl x11, x11, #1
|
||||
WORD $0x5292cfed // mov w13, #38527
|
||||
WORD $0x72a0130d // movk w13, #152, lsl #16
|
||||
WORD $0x6b0d013f // cmp w9, w13
|
||||
WORD $0x54000d29 // b.ls LBB0_33 $420(%rip)
|
||||
Lloh24:
|
||||
WORD $0x10003c2d // adr x13, _Digits $1924(%rip)
|
||||
Lloh25:
|
||||
WORD $0x910001ad // add x13, x13, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x386c69ad // ldrb w13, [x13, x12]
|
||||
WORD $0x3900010d // strb w13, [x8]
|
||||
WORD $0x5280002e // mov w14, #1
|
||||
WORD $0x14000068 // b LBB0_35 $416(%rip)
|
||||
LBB0_31:
|
||||
WORD $0xd2adf82a // mov x10, #1874919424
|
||||
WORD $0xf2d0de4a // movk x10, #34546, lsl #32
|
||||
WORD $0xf2e0046a // movk x10, #35, lsl #48
|
||||
WORD $0xeb0a003f // cmp x1, x10
|
||||
WORD $0x54001ea2 // b.hs LBB0_41 $980(%rip)
|
||||
WORD $0xd299dfa9 // mov x9, #52989
|
||||
WORD $0xf2b08c29 // movk x9, #33889, lsl #16
|
||||
WORD $0xf2cee229 // movk x9, #30481, lsl #32
|
||||
WORD $0xf2f57989 // movk x9, #43980, lsl #48
|
||||
WORD $0x9bc97c29 // umulh x9, x1, x9
|
||||
WORD $0xd35afd29 // lsr x9, x9, #26
|
||||
WORD $0x1b088528 // msub w8, w9, w8, w1
|
||||
WORD $0x6f00e400 // movi.2d v0, #0000000000000000
|
||||
WORD $0x6f00e401 // movi.2d v1, #0000000000000000
|
||||
WORD $0x4e041d21 // mov.s v1[0], w9
|
||||
WORD $0x0ea12822 // xtn.2s v2, v1
|
||||
WORD $0x5282eb29 // mov w9, #5977
|
||||
WORD $0x72ba36e9 // movk w9, #53687, lsl #16
|
||||
WORD $0x0e040d23 // dup.2s v3, w9
|
||||
WORD $0x2ea3c042 // umull.2d v2, v2, v3
|
||||
WORD $0x6f530442 // ushr.2d v2, v2, #45
|
||||
WORD $0x0ea12844 // xtn.2s v4, v2
|
||||
WORD $0x5284e209 // mov w9, #10000
|
||||
WORD $0x0e040d25 // dup.2s v5, w9
|
||||
WORD $0x2ea5c084 // umull.2d v4, v4, v5
|
||||
WORD $0x6ea48421 // sub.4s v1, v1, v4
|
||||
WORD $0x4e413841 // zip1.8h v1, v2, v1
|
||||
WORD $0x4f425421 // shl.2d v1, v1, #2
|
||||
WORD $0x4e413821 // zip1.8h v1, v1, v1
|
||||
WORD $0x4e813821 // zip1.4s v1, v1, v1
|
||||
Lloh26:
|
||||
WORD $0x10ffdee9 // adr x9, lCPI0_0 $-1060(%rip)
|
||||
Lloh27:
|
||||
WORD $0xfd400122 // ldr d2, [x9, lCPI0_0@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e62c024 // umull.4s v4, v1, v2
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e62c021 // umull.4s v1, v1, v2
|
||||
WORD $0x4e415881 // uzp2.8h v1, v4, v1
|
||||
Lloh28:
|
||||
WORD $0x10ffde69 // adr x9, lCPI0_1 $-1076(%rip)
|
||||
Lloh29:
|
||||
WORD $0xfd400124 // ldr d4, [x9, lCPI0_1@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e64c026 // umull.4s v6, v1, v4
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e64c021 // umull.4s v1, v1, v4
|
||||
WORD $0x4e4158c1 // uzp2.8h v1, v6, v1
|
||||
WORD $0x4f008546 // movi.8h v6, #10
|
||||
WORD $0x4e669c27 // mul.8h v7, v1, v6
|
||||
WORD $0x4f5054e7 // shl.2d v7, v7, #16
|
||||
WORD $0x6e678421 // sub.8h v1, v1, v7
|
||||
WORD $0x4e041d00 // mov.s v0[0], w8
|
||||
WORD $0x0ea12807 // xtn.2s v7, v0
|
||||
WORD $0x2ea3c0e3 // umull.2d v3, v7, v3
|
||||
WORD $0x6f530463 // ushr.2d v3, v3, #45
|
||||
WORD $0x0ea12867 // xtn.2s v7, v3
|
||||
WORD $0x2ea5c0e5 // umull.2d v5, v7, v5
|
||||
WORD $0x6ea58400 // sub.4s v0, v0, v5
|
||||
WORD $0x4e403860 // zip1.8h v0, v3, v0
|
||||
WORD $0x4f425400 // shl.2d v0, v0, #2
|
||||
WORD $0x4e403800 // zip1.8h v0, v0, v0
|
||||
WORD $0x4e803800 // zip1.4s v0, v0, v0
|
||||
WORD $0x2e62c003 // umull.4s v3, v0, v2
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e62c000 // umull.4s v0, v0, v2
|
||||
WORD $0x4e405860 // uzp2.8h v0, v3, v0
|
||||
WORD $0x2e64c002 // umull.4s v2, v0, v4
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e64c000 // umull.4s v0, v0, v4
|
||||
WORD $0x4e405840 // uzp2.8h v0, v2, v0
|
||||
WORD $0x4e669c02 // mul.8h v2, v0, v6
|
||||
WORD $0x4f505442 // shl.2d v2, v2, #16
|
||||
WORD $0x6e628400 // sub.8h v0, v0, v2
|
||||
WORD $0x2e212821 // sqxtun.8b v1, v1
|
||||
WORD $0x6e212801 // sqxtun2.16b v1, v0
|
||||
WORD $0x4f01e600 // movi.16b v0, #48
|
||||
WORD $0x4e208420 // add.16b v0, v1, v0
|
||||
WORD $0x4e209821 // cmeq.16b v1, v1, #0
|
||||
Lloh30:
|
||||
WORD $0x10ffda08 // adr x8, lCPI0_2 $-1216(%rip)
|
||||
Lloh31:
|
||||
WORD $0x3dc00102 // ldr q2, [x8, lCPI0_2@PAGEOFF] $0(%rip)
|
||||
WORD $0x4e221c21 // and.16b v1, v1, v2
|
||||
Lloh32:
|
||||
WORD $0x10ffda28 // adr x8, lCPI0_3 $-1212(%rip)
|
||||
Lloh33:
|
||||
WORD $0x3dc00102 // ldr q2, [x8, lCPI0_3@PAGEOFF] $0(%rip)
|
||||
WORD $0x4e020021 // tbl.16b v1, { v1 }, v2
|
||||
WORD $0x4e71b821 // addv.8h h1, v1
|
||||
WORD $0x1e260028 // fmov w8, s1
|
||||
WORD $0x2a2803e8 // mvn w8, w8
|
||||
WORD $0x32114108 // orr w8, w8, #0xffff8000
|
||||
WORD $0x5ac00108 // rbit w8, w8
|
||||
WORD $0x5ac01108 // clz w8, w8
|
||||
Lloh34:
|
||||
WORD $0x10003709 // adr x9, _VecShiftShuffles $1760(%rip)
|
||||
Lloh35:
|
||||
WORD $0x91000129 // add x9, x9, _VecShiftShuffles@PAGEOFF $0(%rip)
|
||||
WORD $0x3ce85921 // ldr q1, [x9, w8, uxtw #4]
|
||||
WORD $0x4f04e5e2 // movi.16b v2, #143
|
||||
WORD $0x4e221c21 // and.16b v1, v1, v2
|
||||
WORD $0x4e010000 // tbl.16b v0, { v0 }, v1
|
||||
WORD $0x3d800000 // str q0, [x0]
|
||||
WORD $0x52800209 // mov w9, #16
|
||||
WORD $0x4b080128 // sub w8, w9, w8
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_33:
|
||||
WORD $0x528847ed // mov w13, #16959
|
||||
WORD $0x72a001ed // movk w13, #15, lsl #16
|
||||
WORD $0x6b0d013f // cmp w9, w13
|
||||
WORD $0x54000569 // b.ls LBB0_38 $172(%rip)
|
||||
WORD $0x5280000e // mov w14, #0
|
||||
LBB0_35:
|
||||
Lloh36:
|
||||
WORD $0x10002e8d // adr x13, _Digits $1488(%rip)
|
||||
Lloh37:
|
||||
WORD $0x910001ad // add x13, x13, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b2c41ac // add x12, x13, w12, uxtw
|
||||
WORD $0x3940058c // ldrb w12, [x12, #1]
|
||||
WORD $0x110005cd // add w13, w14, #1
|
||||
WORD $0x382e490c // strb w12, [x8, w14, uxtw]
|
||||
LBB0_36:
|
||||
Lloh38:
|
||||
WORD $0x10002dcc // adr x12, _Digits $1464(%rip)
|
||||
Lloh39:
|
||||
WORD $0x9100018c // add x12, x12, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x386b698e // ldrb w14, [x12, x11]
|
||||
WORD $0x110005ac // add w12, w13, #1
|
||||
WORD $0x382d490e // strb w14, [x8, w13, uxtw]
|
||||
LBB0_37:
|
||||
WORD $0x5284e20d // mov w13, #10000
|
||||
WORD $0x1b0da549 // msub w9, w10, w13, w9
|
||||
WORD $0x53023d2a // ubfx w10, w9, #2, #14
|
||||
WORD $0x52828f6d // mov w13, #5243
|
||||
WORD $0x1b0d7d4a // mul w10, w10, w13
|
||||
WORD $0x53117d4a // lsr w10, w10, #17
|
||||
WORD $0x52800c8d // mov w13, #100
|
||||
WORD $0x1b0da549 // msub w9, w10, w13, w9
|
||||
WORD $0x92403d29 // and x9, x9, #0xffff
|
||||
WORD $0xd37ff929 // lsl x9, x9, #1
|
||||
Lloh40:
|
||||
WORD $0x10002bed // adr x13, _Digits $1404(%rip)
|
||||
Lloh41:
|
||||
WORD $0x910001ad // add x13, x13, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x8b2b21ab // add x11, x13, w11, uxth
|
||||
WORD $0x3940056b // ldrb w11, [x11, #1]
|
||||
WORD $0x8b2c4108 // add x8, x8, w12, uxtw
|
||||
WORD $0x3900010b // strb w11, [x8]
|
||||
WORD $0x786a59aa // ldrh w10, [x13, w10, uxtw #1]
|
||||
WORD $0x7800110a // sturh w10, [x8, #1]
|
||||
WORD $0x386969aa // ldrb w10, [x13, x9]
|
||||
WORD $0x39000d0a // strb w10, [x8, #3]
|
||||
WORD $0x927f3929 // and x9, x9, #0xfffe
|
||||
WORD $0x8b0901a9 // add x9, x13, x9
|
||||
WORD $0x3940052a // ldrb w10, [x9, #1]
|
||||
WORD $0x11001589 // add w9, w12, #5
|
||||
WORD $0x3900110a // strb w10, [x8, #4]
|
||||
WORD $0x11000528 // add w8, w9, #1
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_38:
|
||||
WORD $0x5280000d // mov w13, #0
|
||||
WORD $0x5280000c // mov w12, #0
|
||||
WORD $0x53057d2e // lsr w14, w9, #5
|
||||
WORD $0x7130d5df // cmp w14, #3125
|
||||
WORD $0x54fffb22 // b.hs LBB0_36 $-156(%rip)
|
||||
WORD $0x17ffffdd // b LBB0_37 $-140(%rip)
|
||||
LBB0_39:
|
||||
WORD $0xd2adf82c // mov x12, #1874919424
|
||||
WORD $0xf2d0de4c // movk x12, #34546, lsl #32
|
||||
WORD $0xf2e0046c // movk x12, #35, lsl #48
|
||||
WORD $0xeb0c013f // cmp x9, x12
|
||||
WORD $0x540019e2 // b.hs LBB0_47 $828(%rip)
|
||||
WORD $0xd299dfab // mov x11, #52989
|
||||
WORD $0xf2b08c2b // movk x11, #33889, lsl #16
|
||||
WORD $0xf2cee22b // movk x11, #30481, lsl #32
|
||||
WORD $0xf2f5798b // movk x11, #43980, lsl #48
|
||||
WORD $0x9bcb7d2b // umulh x11, x9, x11
|
||||
WORD $0xd35afd6b // lsr x11, x11, #26
|
||||
WORD $0x1b0aa569 // msub w9, w11, w10, w9
|
||||
WORD $0x6f00e400 // movi.2d v0, #0000000000000000
|
||||
WORD $0x6f00e401 // movi.2d v1, #0000000000000000
|
||||
WORD $0x4e041d61 // mov.s v1[0], w11
|
||||
WORD $0x0ea12822 // xtn.2s v2, v1
|
||||
WORD $0x5282eb2a // mov w10, #5977
|
||||
WORD $0x72ba36ea // movk w10, #53687, lsl #16
|
||||
WORD $0x0e040d43 // dup.2s v3, w10
|
||||
WORD $0x2ea3c042 // umull.2d v2, v2, v3
|
||||
WORD $0x6f530442 // ushr.2d v2, v2, #45
|
||||
WORD $0x0ea12844 // xtn.2s v4, v2
|
||||
WORD $0x5284e20a // mov w10, #10000
|
||||
WORD $0x0e040d45 // dup.2s v5, w10
|
||||
WORD $0x2ea5c084 // umull.2d v4, v4, v5
|
||||
WORD $0x6ea48421 // sub.4s v1, v1, v4
|
||||
WORD $0x4e413841 // zip1.8h v1, v2, v1
|
||||
WORD $0x4f425421 // shl.2d v1, v1, #2
|
||||
WORD $0x4e413821 // zip1.8h v1, v1, v1
|
||||
WORD $0x4e813821 // zip1.4s v1, v1, v1
|
||||
Lloh42:
|
||||
WORD $0x10ffcc2a // adr x10, lCPI0_0 $-1660(%rip)
|
||||
Lloh43:
|
||||
WORD $0xfd400142 // ldr d2, [x10, lCPI0_0@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e62c024 // umull.4s v4, v1, v2
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e62c021 // umull.4s v1, v1, v2
|
||||
WORD $0x4e415881 // uzp2.8h v1, v4, v1
|
||||
Lloh44:
|
||||
WORD $0x10ffcbaa // adr x10, lCPI0_1 $-1676(%rip)
|
||||
Lloh45:
|
||||
WORD $0xfd400144 // ldr d4, [x10, lCPI0_1@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e64c026 // umull.4s v6, v1, v4
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e64c021 // umull.4s v1, v1, v4
|
||||
WORD $0x4e4158c1 // uzp2.8h v1, v6, v1
|
||||
WORD $0x4f008546 // movi.8h v6, #10
|
||||
WORD $0x4e669c27 // mul.8h v7, v1, v6
|
||||
WORD $0x4f5054e7 // shl.2d v7, v7, #16
|
||||
WORD $0x6e678421 // sub.8h v1, v1, v7
|
||||
WORD $0x4e041d20 // mov.s v0[0], w9
|
||||
WORD $0x0ea12807 // xtn.2s v7, v0
|
||||
WORD $0x2ea3c0e3 // umull.2d v3, v7, v3
|
||||
WORD $0x6f530463 // ushr.2d v3, v3, #45
|
||||
WORD $0x0ea12867 // xtn.2s v7, v3
|
||||
WORD $0x2ea5c0e5 // umull.2d v5, v7, v5
|
||||
WORD $0x6ea58400 // sub.4s v0, v0, v5
|
||||
WORD $0x4e403860 // zip1.8h v0, v3, v0
|
||||
WORD $0x4f425400 // shl.2d v0, v0, #2
|
||||
WORD $0x4e403800 // zip1.8h v0, v0, v0
|
||||
WORD $0x4e803800 // zip1.4s v0, v0, v0
|
||||
WORD $0x2e62c003 // umull.4s v3, v0, v2
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e62c000 // umull.4s v0, v0, v2
|
||||
WORD $0x4e405860 // uzp2.8h v0, v3, v0
|
||||
WORD $0x2e64c002 // umull.4s v2, v0, v4
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e64c000 // umull.4s v0, v0, v4
|
||||
WORD $0x4e405840 // uzp2.8h v0, v2, v0
|
||||
WORD $0x4e669c02 // mul.8h v2, v0, v6
|
||||
WORD $0x4f505442 // shl.2d v2, v2, #16
|
||||
WORD $0x6e628400 // sub.8h v0, v0, v2
|
||||
WORD $0x2e212821 // sqxtun.8b v1, v1
|
||||
WORD $0x6e212801 // sqxtun2.16b v1, v0
|
||||
WORD $0x4f01e600 // movi.16b v0, #48
|
||||
WORD $0x4e208420 // add.16b v0, v1, v0
|
||||
WORD $0x4e209821 // cmeq.16b v1, v1, #0
|
||||
Lloh46:
|
||||
WORD $0x10ffc749 // adr x9, lCPI0_2 $-1816(%rip)
|
||||
Lloh47:
|
||||
WORD $0x3dc00122 // ldr q2, [x9, lCPI0_2@PAGEOFF] $0(%rip)
|
||||
WORD $0x4e221c21 // and.16b v1, v1, v2
|
||||
Lloh48:
|
||||
WORD $0x10ffc769 // adr x9, lCPI0_3 $-1812(%rip)
|
||||
Lloh49:
|
||||
WORD $0x3dc00122 // ldr q2, [x9, lCPI0_3@PAGEOFF] $0(%rip)
|
||||
WORD $0x4e020021 // tbl.16b v1, { v1 }, v2
|
||||
WORD $0x4e71b821 // addv.8h h1, v1
|
||||
WORD $0x1e260029 // fmov w9, s1
|
||||
WORD $0x2a2903e9 // mvn w9, w9
|
||||
WORD $0x32114129 // orr w9, w9, #0xffff8000
|
||||
WORD $0x5ac00129 // rbit w9, w9
|
||||
WORD $0x5ac01129 // clz w9, w9
|
||||
Lloh50:
|
||||
WORD $0x1000244a // adr x10, _VecShiftShuffles $1160(%rip)
|
||||
Lloh51:
|
||||
WORD $0x9100014a // add x10, x10, _VecShiftShuffles@PAGEOFF $0(%rip)
|
||||
WORD $0x3ce95941 // ldr q1, [x10, w9, uxtw #4]
|
||||
WORD $0x4f04e5e2 // movi.16b v2, #143
|
||||
WORD $0x4e221c21 // and.16b v1, v1, v2
|
||||
WORD $0x4e010000 // tbl.16b v0, { v0 }, v1
|
||||
WORD $0x3d800100 // str q0, [x8]
|
||||
WORD $0x52800208 // mov w8, #16
|
||||
WORD $0x4b090109 // sub w9, w8, w9
|
||||
WORD $0x11000528 // add w8, w9, #1
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_41:
|
||||
WORD $0xd28f0ae9 // mov x9, #30807
|
||||
WORD $0xf2b62269 // movk x9, #45331, lsl #16
|
||||
WORD $0xf2cca5e9 // movk x9, #25903, lsl #32
|
||||
WORD $0xf2e734a9 // movk x9, #14757, lsl #48
|
||||
WORD $0x9bc97c29 // umulh x9, x1, x9
|
||||
WORD $0xd373fd2b // lsr x11, x9, #51
|
||||
WORD $0x7100257f // cmp w11, #9
|
||||
WORD $0x540000a8 // b.hi LBB0_43 $20(%rip)
|
||||
WORD $0x1100c169 // add w9, w11, #48
|
||||
WORD $0x39000009 // strb w9, [x0]
|
||||
WORD $0x52800029 // mov w9, #1
|
||||
WORD $0x1400001b // b LBB0_46 $108(%rip)
|
||||
LBB0_43:
|
||||
WORD $0x71018d7f // cmp w11, #99
|
||||
WORD $0x540000e8 // b.hi LBB0_45 $28(%rip)
|
||||
Lloh52:
|
||||
WORD $0x10001a89 // adr x9, _Digits $848(%rip)
|
||||
Lloh53:
|
||||
WORD $0x91000129 // add x9, x9, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x786b5929 // ldrh w9, [x9, w11, uxtw #1]
|
||||
WORD $0x79000009 // strh w9, [x0]
|
||||
WORD $0x52800049 // mov w9, #2
|
||||
WORD $0x14000013 // b LBB0_46 $76(%rip)
|
||||
LBB0_45:
|
||||
WORD $0x5280a3e9 // mov w9, #1311
|
||||
WORD $0x1b097d69 // mul w9, w11, w9
|
||||
WORD $0x53117d29 // lsr w9, w9, #17
|
||||
WORD $0x321c052c // orr w12, w9, #0x30
|
||||
WORD $0x3900000c // strb w12, [x0]
|
||||
WORD $0x52800c8c // mov w12, #100
|
||||
WORD $0x1b0cad29 // msub w9, w9, w12, w11
|
||||
WORD $0x92403d29 // and x9, x9, #0xffff
|
||||
WORD $0xd37ff929 // lsl x9, x9, #1
|
||||
Lloh54:
|
||||
WORD $0x100018ac // adr x12, _Digits $788(%rip)
|
||||
Lloh55:
|
||||
WORD $0x9100018c // add x12, x12, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x3869698d // ldrb w13, [x12, x9]
|
||||
WORD $0x3900040d // strb w13, [x0, #1]
|
||||
WORD $0x927f3929 // and x9, x9, #0xfffe
|
||||
WORD $0x8b090189 // add x9, x12, x9
|
||||
WORD $0x39400529 // ldrb w9, [x9, #1]
|
||||
WORD $0x39000809 // strb w9, [x0, #2]
|
||||
WORD $0x52800069 // mov w9, #3
|
||||
LBB0_46:
|
||||
WORD $0x9b0a856a // msub x10, x11, x10, x1
|
||||
WORD $0xd299dfab // mov x11, #52989
|
||||
WORD $0xf2b08c2b // movk x11, #33889, lsl #16
|
||||
WORD $0xf2cee22b // movk x11, #30481, lsl #32
|
||||
WORD $0xf2f5798b // movk x11, #43980, lsl #48
|
||||
WORD $0x9bcb7d4b // umulh x11, x10, x11
|
||||
WORD $0xd35afd6b // lsr x11, x11, #26
|
||||
WORD $0x6f00e400 // movi.2d v0, #0000000000000000
|
||||
WORD $0x6f00e401 // movi.2d v1, #0000000000000000
|
||||
WORD $0x4e041d61 // mov.s v1[0], w11
|
||||
WORD $0x5282eb2c // mov w12, #5977
|
||||
WORD $0x72ba36ec // movk w12, #53687, lsl #16
|
||||
WORD $0x0e040d82 // dup.2s v2, w12
|
||||
WORD $0x0ea12823 // xtn.2s v3, v1
|
||||
WORD $0x2ea2c063 // umull.2d v3, v3, v2
|
||||
WORD $0x6f530463 // ushr.2d v3, v3, #45
|
||||
WORD $0x5284e20c // mov w12, #10000
|
||||
WORD $0x0e040d84 // dup.2s v4, w12
|
||||
WORD $0x0ea12865 // xtn.2s v5, v3
|
||||
WORD $0x2ea4c0a5 // umull.2d v5, v5, v4
|
||||
WORD $0x6ea58421 // sub.4s v1, v1, v5
|
||||
WORD $0x4e413861 // zip1.8h v1, v3, v1
|
||||
WORD $0x4f425421 // shl.2d v1, v1, #2
|
||||
WORD $0x4e413821 // zip1.8h v1, v1, v1
|
||||
WORD $0x4e813821 // zip1.4s v1, v1, v1
|
||||
Lloh56:
|
||||
WORD $0x10ffbbac // adr x12, lCPI0_0 $-2188(%rip)
|
||||
Lloh57:
|
||||
WORD $0xfd400183 // ldr d3, [x12, lCPI0_0@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e63c025 // umull.4s v5, v1, v3
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e63c021 // umull.4s v1, v1, v3
|
||||
WORD $0x4e4158a1 // uzp2.8h v1, v5, v1
|
||||
Lloh58:
|
||||
WORD $0x10ffbb2c // adr x12, lCPI0_1 $-2204(%rip)
|
||||
Lloh59:
|
||||
WORD $0xfd400185 // ldr d5, [x12, lCPI0_1@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e65c026 // umull.4s v6, v1, v5
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e65c021 // umull.4s v1, v1, v5
|
||||
WORD $0x4e4158c1 // uzp2.8h v1, v6, v1
|
||||
WORD $0x4f008546 // movi.8h v6, #10
|
||||
WORD $0x4e669c27 // mul.8h v7, v1, v6
|
||||
WORD $0x4f5054e7 // shl.2d v7, v7, #16
|
||||
WORD $0x6e678421 // sub.8h v1, v1, v7
|
||||
WORD $0x1b08a968 // msub w8, w11, w8, w10
|
||||
WORD $0x4e041d00 // mov.s v0[0], w8
|
||||
WORD $0x0ea12807 // xtn.2s v7, v0
|
||||
WORD $0x2ea2c0e2 // umull.2d v2, v7, v2
|
||||
WORD $0x6f530442 // ushr.2d v2, v2, #45
|
||||
WORD $0x0ea12847 // xtn.2s v7, v2
|
||||
WORD $0x2ea4c0e4 // umull.2d v4, v7, v4
|
||||
WORD $0x6ea48400 // sub.4s v0, v0, v4
|
||||
WORD $0x4e403840 // zip1.8h v0, v2, v0
|
||||
WORD $0x4f425400 // shl.2d v0, v0, #2
|
||||
WORD $0x4e403800 // zip1.8h v0, v0, v0
|
||||
WORD $0x4e803800 // zip1.4s v0, v0, v0
|
||||
WORD $0x2e63c002 // umull.4s v2, v0, v3
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e63c000 // umull.4s v0, v0, v3
|
||||
WORD $0x4e405840 // uzp2.8h v0, v2, v0
|
||||
WORD $0x2e65c002 // umull.4s v2, v0, v5
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e65c000 // umull.4s v0, v0, v5
|
||||
WORD $0x4e405840 // uzp2.8h v0, v2, v0
|
||||
WORD $0x4e669c02 // mul.8h v2, v0, v6
|
||||
WORD $0x4f505442 // shl.2d v2, v2, #16
|
||||
WORD $0x6e628400 // sub.8h v0, v0, v2
|
||||
WORD $0x2e212821 // sqxtun.8b v1, v1
|
||||
WORD $0x6e212801 // sqxtun2.16b v1, v0
|
||||
WORD $0x4f01e600 // movi.16b v0, #48
|
||||
WORD $0x4e208420 // add.16b v0, v1, v0
|
||||
WORD $0x3ca94800 // str q0, [x0, w9, uxtw]
|
||||
WORD $0x321c0128 // orr w8, w9, #0x10
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_47:
|
||||
WORD $0xd28f0aeb // mov x11, #30807
|
||||
WORD $0xf2b6226b // movk x11, #45331, lsl #16
|
||||
WORD $0xf2cca5eb // movk x11, #25903, lsl #32
|
||||
WORD $0xf2e734ab // movk x11, #14757, lsl #48
|
||||
WORD $0x9bcb7d2b // umulh x11, x9, x11
|
||||
WORD $0xd373fd6d // lsr x13, x11, #51
|
||||
WORD $0x710025bf // cmp w13, #9
|
||||
WORD $0x540000a8 // b.hi LBB0_49 $20(%rip)
|
||||
WORD $0x1100c1ab // add w11, w13, #48
|
||||
WORD $0x3900010b // strb w11, [x8]
|
||||
WORD $0x5280002b // mov w11, #1
|
||||
WORD $0x1400001c // b LBB0_52 $112(%rip)
|
||||
LBB0_49:
|
||||
WORD $0x71018dbf // cmp w13, #99
|
||||
WORD $0x540000e8 // b.hi LBB0_51 $28(%rip)
|
||||
Lloh60:
|
||||
WORD $0x10000c8b // adr x11, _Digits $400(%rip)
|
||||
Lloh61:
|
||||
WORD $0x9100016b // add x11, x11, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x786d596b // ldrh w11, [x11, w13, uxtw #1]
|
||||
WORD $0x7800100b // sturh w11, [x0, #1]
|
||||
WORD $0x5280004b // mov w11, #2
|
||||
WORD $0x14000014 // b LBB0_52 $80(%rip)
|
||||
LBB0_51:
|
||||
WORD $0x53023dab // ubfx w11, w13, #2, #14
|
||||
WORD $0x52828f6e // mov w14, #5243
|
||||
WORD $0x1b0e7d6b // mul w11, w11, w14
|
||||
WORD $0x53117d6b // lsr w11, w11, #17
|
||||
WORD $0x321c056e // orr w14, w11, #0x30
|
||||
WORD $0x3900040e // strb w14, [x0, #1]
|
||||
WORD $0x52800c8e // mov w14, #100
|
||||
WORD $0x1b0eb56b // msub w11, w11, w14, w13
|
||||
WORD $0x92403d6b // and x11, x11, #0xffff
|
||||
WORD $0xd37ff96b // lsl x11, x11, #1
|
||||
Lloh62:
|
||||
WORD $0x10000a8e // adr x14, _Digits $336(%rip)
|
||||
Lloh63:
|
||||
WORD $0x910001ce // add x14, x14, _Digits@PAGEOFF $0(%rip)
|
||||
WORD $0x386b69cf // ldrb w15, [x14, x11]
|
||||
WORD $0x3900080f // strb w15, [x0, #2]
|
||||
WORD $0x927f396b // and x11, x11, #0xfffe
|
||||
WORD $0x8b0b01cb // add x11, x14, x11
|
||||
WORD $0x3940056b // ldrb w11, [x11, #1]
|
||||
WORD $0x39000c0b // strb w11, [x0, #3]
|
||||
WORD $0x5280006b // mov w11, #3
|
||||
LBB0_52:
|
||||
WORD $0x9b0ca5a9 // msub x9, x13, x12, x9
|
||||
WORD $0xd299dfac // mov x12, #52989
|
||||
WORD $0xf2b08c2c // movk x12, #33889, lsl #16
|
||||
WORD $0xf2cee22c // movk x12, #30481, lsl #32
|
||||
WORD $0xf2f5798c // movk x12, #43980, lsl #48
|
||||
WORD $0x9bcc7d2c // umulh x12, x9, x12
|
||||
WORD $0xd35afd8c // lsr x12, x12, #26
|
||||
WORD $0x6f00e400 // movi.2d v0, #0000000000000000
|
||||
WORD $0x6f00e401 // movi.2d v1, #0000000000000000
|
||||
WORD $0x4e041d81 // mov.s v1[0], w12
|
||||
WORD $0x5282eb2d // mov w13, #5977
|
||||
WORD $0x72ba36ed // movk w13, #53687, lsl #16
|
||||
WORD $0x0e040da2 // dup.2s v2, w13
|
||||
WORD $0x0ea12823 // xtn.2s v3, v1
|
||||
WORD $0x2ea2c063 // umull.2d v3, v3, v2
|
||||
WORD $0x6f530463 // ushr.2d v3, v3, #45
|
||||
WORD $0x5284e20d // mov w13, #10000
|
||||
WORD $0x0e040da4 // dup.2s v4, w13
|
||||
WORD $0x0ea12865 // xtn.2s v5, v3
|
||||
WORD $0x2ea4c0a5 // umull.2d v5, v5, v4
|
||||
WORD $0x6ea58421 // sub.4s v1, v1, v5
|
||||
WORD $0x4e413861 // zip1.8h v1, v3, v1
|
||||
WORD $0x4f425421 // shl.2d v1, v1, #2
|
||||
WORD $0x4e413821 // zip1.8h v1, v1, v1
|
||||
WORD $0x4e813821 // zip1.4s v1, v1, v1
|
||||
Lloh64:
|
||||
WORD $0x10ffad8d // adr x13, lCPI0_0 $-2640(%rip)
|
||||
Lloh65:
|
||||
WORD $0xfd4001a3 // ldr d3, [x13, lCPI0_0@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e63c025 // umull.4s v5, v1, v3
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e63c021 // umull.4s v1, v1, v3
|
||||
WORD $0x4e4158a1 // uzp2.8h v1, v5, v1
|
||||
Lloh66:
|
||||
WORD $0x10ffad0d // adr x13, lCPI0_1 $-2656(%rip)
|
||||
Lloh67:
|
||||
WORD $0xfd4001a5 // ldr d5, [x13, lCPI0_1@PAGEOFF] $0(%rip)
|
||||
WORD $0x2e65c026 // umull.4s v6, v1, v5
|
||||
WORD $0x6e014021 // ext.16b v1, v1, v1, #8
|
||||
WORD $0x2e65c021 // umull.4s v1, v1, v5
|
||||
WORD $0x4e4158c1 // uzp2.8h v1, v6, v1
|
||||
WORD $0x4f008546 // movi.8h v6, #10
|
||||
WORD $0x4e669c27 // mul.8h v7, v1, v6
|
||||
WORD $0x4f5054e7 // shl.2d v7, v7, #16
|
||||
WORD $0x6e678421 // sub.8h v1, v1, v7
|
||||
WORD $0x1b0aa589 // msub w9, w12, w10, w9
|
||||
WORD $0x4e041d20 // mov.s v0[0], w9
|
||||
WORD $0x0ea12807 // xtn.2s v7, v0
|
||||
WORD $0x2ea2c0e2 // umull.2d v2, v7, v2
|
||||
WORD $0x6f530442 // ushr.2d v2, v2, #45
|
||||
WORD $0x0ea12847 // xtn.2s v7, v2
|
||||
WORD $0x2ea4c0e4 // umull.2d v4, v7, v4
|
||||
WORD $0x6ea48400 // sub.4s v0, v0, v4
|
||||
WORD $0x4e403840 // zip1.8h v0, v2, v0
|
||||
WORD $0x4f425400 // shl.2d v0, v0, #2
|
||||
WORD $0x4e403800 // zip1.8h v0, v0, v0
|
||||
WORD $0x4e803800 // zip1.4s v0, v0, v0
|
||||
WORD $0x2e63c002 // umull.4s v2, v0, v3
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e63c000 // umull.4s v0, v0, v3
|
||||
WORD $0x4e405840 // uzp2.8h v0, v2, v0
|
||||
WORD $0x2e65c002 // umull.4s v2, v0, v5
|
||||
WORD $0x6e004000 // ext.16b v0, v0, v0, #8
|
||||
WORD $0x2e65c000 // umull.4s v0, v0, v5
|
||||
WORD $0x4e405840 // uzp2.8h v0, v2, v0
|
||||
WORD $0x4e669c02 // mul.8h v2, v0, v6
|
||||
WORD $0x4f505442 // shl.2d v2, v2, #16
|
||||
WORD $0x6e628400 // sub.8h v0, v0, v2
|
||||
WORD $0x2e212821 // sqxtun.8b v1, v1
|
||||
WORD $0x6e212801 // sqxtun2.16b v1, v0
|
||||
WORD $0x4f01e600 // movi.16b v0, #48
|
||||
WORD $0x4e208420 // add.16b v0, v1, v0
|
||||
WORD $0x3cab4900 // str q0, [x8, w11, uxtw]
|
||||
WORD $0x321c0169 // orr w9, w11, #0x10
|
||||
WORD $0x11000528 // add w8, w9, #1
|
||||
WORD $0xaa0803e0 // mov x0, x8
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
_Digits:
|
||||
WORD $0x31303030 // .ascii 4, '0001020304050607'
|
||||
WORD $0x33303230 // .ascii 4, '0203040506070809'
|
||||
WORD $0x35303430 // .ascii 4, '0405060708091011'
|
||||
WORD $0x37303630 // .ascii 4, '0607080910111213'
|
||||
WORD $0x39303830 // .ascii 4, '0809101112131415'
|
||||
WORD $0x31313031 // .ascii 4, '1011121314151617'
|
||||
WORD $0x33313231 // .ascii 4, '1213141516171819'
|
||||
WORD $0x35313431 // .ascii 4, '1415161718192021'
|
||||
WORD $0x37313631 // .ascii 4, '1617181920212223'
|
||||
WORD $0x39313831 // .ascii 4, '1819202122232425'
|
||||
WORD $0x31323032 // .ascii 4, '2021222324252627'
|
||||
WORD $0x33323232 // .ascii 4, '2223242526272829'
|
||||
WORD $0x35323432 // .ascii 4, '2425262728293031'
|
||||
WORD $0x37323632 // .ascii 4, '2627282930313233'
|
||||
WORD $0x39323832 // .ascii 4, '2829303132333435'
|
||||
WORD $0x31333033 // .ascii 4, '3031323334353637'
|
||||
WORD $0x33333233 // .ascii 4, '3233343536373839'
|
||||
WORD $0x35333433 // .ascii 4, '3435363738394041'
|
||||
WORD $0x37333633 // .ascii 4, '3637383940414243'
|
||||
WORD $0x39333833 // .ascii 4, '3839404142434445'
|
||||
WORD $0x31343034 // .ascii 4, '4041424344454647'
|
||||
WORD $0x33343234 // .ascii 4, '4243444546474849'
|
||||
WORD $0x35343434 // .ascii 4, '4445464748495051'
|
||||
WORD $0x37343634 // .ascii 4, '4647484950515253'
|
||||
WORD $0x39343834 // .ascii 4, '4849505152535455'
|
||||
WORD $0x31353035 // .ascii 4, '5051525354555657'
|
||||
WORD $0x33353235 // .ascii 4, '5253545556575859'
|
||||
WORD $0x35353435 // .ascii 4, '5455565758596061'
|
||||
WORD $0x37353635 // .ascii 4, '5657585960616263'
|
||||
WORD $0x39353835 // .ascii 4, '5859606162636465'
|
||||
WORD $0x31363036 // .ascii 4, '6061626364656667'
|
||||
WORD $0x33363236 // .ascii 4, '6263646566676869'
|
||||
WORD $0x35363436 // .ascii 4, '6465666768697071'
|
||||
WORD $0x37363636 // .ascii 4, '6667686970717273'
|
||||
WORD $0x39363836 // .ascii 4, '6869707172737475'
|
||||
WORD $0x31373037 // .ascii 4, '7071727374757677'
|
||||
WORD $0x33373237 // .ascii 4, '7273747576777879'
|
||||
WORD $0x35373437 // .ascii 4, '7475767778798081'
|
||||
WORD $0x37373637 // .ascii 4, '7677787980818283'
|
||||
WORD $0x39373837 // .ascii 4, '7879808182838485'
|
||||
WORD $0x31383038 // .ascii 4, '8081828384858687'
|
||||
WORD $0x33383238 // .ascii 4, '8283848586878889'
|
||||
WORD $0x35383438 // .ascii 4, '8485868788899091'
|
||||
WORD $0x37383638 // .ascii 4, '8687888990919293'
|
||||
WORD $0x39383838 // .ascii 4, '8889909192939495'
|
||||
WORD $0x31393039 // .ascii 4, '9091929394959697'
|
||||
WORD $0x33393239 // .ascii 4, '9293949596979899'
|
||||
WORD $0x35393439 // .ascii 4, '949596979899'
|
||||
WORD $0x37393639 // .ascii 4, '96979899'
|
||||
WORD $0x39393839 // .ascii 4, '9899'
|
||||
// .p2align 4, 0x00
|
||||
_VecShiftShuffles:
|
||||
WORD $0x03020100 // .ascii 4, '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
|
||||
WORD $0x07060504 // .ascii 4, '\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x01\x02\x03\x04'
|
||||
WORD $0x0b0a0908 // .ascii 4, '\x08\t\n\x0b\x0c\r\x0e\x0f\x01\x02\x03\x04\x05\x06\x07\x08'
|
||||
WORD $0x0f0e0d0c // .ascii 4, '\x0c\r\x0e\x0f\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c'
|
||||
WORD $0x04030201 // .ascii 4, '\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff'
|
||||
WORD $0x08070605 // .ascii 4, '\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\x02\x03\x04\x05'
|
||||
WORD $0x0c0b0a09 // .ascii 4, '\t\n\x0b\x0c\r\x0e\x0f\xff\x02\x03\x04\x05\x06\x07\x08\t'
|
||||
WORD $0xff0f0e0d // .ascii 4, '\r\x0e\x0f\xff\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r'
|
||||
WORD $0x05040302 // .ascii 4, '\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff'
|
||||
WORD $0x09080706 // .ascii 4, '\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\x03\x04\x05\x06'
|
||||
WORD $0x0d0c0b0a // .ascii 4, '\n\x0b\x0c\r\x0e\x0f\xff\xff\x03\x04\x05\x06\x07\x08\t\n'
|
||||
WORD $0xffff0f0e // .ascii 4, '\x0e\x0f\xff\xff\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e'
|
||||
WORD $0x06050403 // .ascii 4, '\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff'
|
||||
WORD $0x0a090807 // .ascii 4, '\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\x04\x05\x06\x07'
|
||||
WORD $0x0e0d0c0b // .ascii 4, '\x0b\x0c\r\x0e\x0f\xff\xff\xff\x04\x05\x06\x07\x08\t\n\x0b'
|
||||
WORD $0xffffff0f // .ascii 4, '\x0f\xff\xff\xff\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
|
||||
WORD $0x07060504 // .ascii 4, '\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff'
|
||||
WORD $0x0b0a0908 // .ascii 4, '\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\x05\x06\x07\x08'
|
||||
WORD $0x0f0e0d0c // .ascii 4, '\x0c\r\x0e\x0f\xff\xff\xff\xff\x05\x06\x07\x08\t\n\x0b\x0c'
|
||||
WORD $0xffffffff // .ascii 4, '\xff\xff\xff\xff\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff'
|
||||
WORD $0x08070605 // .ascii 4, '\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff'
|
||||
WORD $0x0c0b0a09 // .ascii 4, '\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\x06\x07\x08\t'
|
||||
WORD $0xff0f0e0d // .ascii 4, '\r\x0e\x0f\xff\xff\xff\xff\xff\x06\x07\x08\t\n\x0b\x0c\r'
|
||||
WORD $0xffffffff // .ascii 4, '\xff\xff\xff\xff\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff'
|
||||
WORD $0x09080706 // .ascii 4, '\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff'
|
||||
WORD $0x0d0c0b0a // .ascii 4, '\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\x07\x08\t\n'
|
||||
WORD $0xffff0f0e // .ascii 4, '\x0e\x0f\xff\xff\xff\xff\xff\xff\x07\x08\t\n\x0b\x0c\r\x0e'
|
||||
WORD $0xffffffff // .ascii 4, '\xff\xff\xff\xff\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff'
|
||||
WORD $0x0a090807 // .ascii 4, '\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\xff'
|
||||
WORD $0x0e0d0c0b // .ascii 4, '\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\x08\t\n\x0b'
|
||||
WORD $0xffffff0f // .ascii 4, '\x0f\xff\xff\xff\xff\xff\xff\xff\x08\t\n\x0b\x0c\r\x0e\x0f'
|
||||
WORD $0xffffffff // .ascii 4, '\xff\xff\xff\xff\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff'
|
||||
WORD $0x0b0a0908 // .ascii 4, '\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff'
|
||||
WORD $0x0f0e0d0c // .ascii 4, '\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff'
|
||||
WORD $0xffffffff // .ascii 4, '\xff\xff\xff\xff\xff\xff\xff\xff'
|
||||
WORD $0xffffffff // .ascii 4, '\xff\xff\xff\xff'
|
||||
|
||||
TEXT ·__i64toa(SB), NOSPLIT, $0-24
|
||||
NO_LOCAL_POINTERS
|
||||
|
||||
_entry:
|
||||
MOVD 16(g), R16
|
||||
SUB $96, RSP, R17
|
||||
CMP R16, R17
|
||||
BLS _stack_grow
|
||||
|
||||
_i64toa:
|
||||
MOVD out+0(FP), R0
|
||||
MOVD val+8(FP), R1
|
||||
MOVD ·_subr__i64toa(SB), R11
|
||||
WORD $0x1000005e // adr x30, .+8
|
||||
JMP (R11)
|
||||
MOVD R0, ret+16(FP)
|
||||
RET
|
||||
|
||||
_stack_grow:
|
||||
MOVD R30, R3
|
||||
CALL runtime·morestack_noctxt<>(SB)
|
||||
JMP _entry
|
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __i64toa_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__i64toa uintptr = __i64toa_entry__() + 48
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__i64toa = 32
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__i64toa
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__i64toa
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
import (
|
||||
`unsafe`
|
||||
|
||||
// `github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
func lspace(sp unsafe.Pointer, nb int, off int) (ret int) {
|
||||
return __lspace(sp, nb, off)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __lspace(sp unsafe.Pointer, nb int, off int) (ret int)
|
@ -0,0 +1,68 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
#include "go_asm.h"
|
||||
#include "funcdata.h"
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·__lspace_entry__(SB), NOSPLIT, $16
|
||||
NO_LOCAL_POINTERS
|
||||
WORD $0x100000a0 // adr x0, .+20
|
||||
MOVD R0, ret(FP)
|
||||
RET
|
||||
// .p2align 2, 0x00
|
||||
_lspace:
|
||||
WORD $0xd10083ff // sub sp, sp, #32
|
||||
WORD $0xa900fbfd // stp fp, lr, [sp, #8]
|
||||
WORD $0xa93ffbfd // stp fp, lr, [sp, #-8]
|
||||
WORD $0xd10023fd // sub fp, sp, #8
|
||||
WORD $0xeb02003f // cmp x1, x2
|
||||
WORD $0x54000061 // b.ne LBB0_2 $12(%rip)
|
||||
WORD $0x8b020008 // add x8, x0, x2
|
||||
WORD $0x1400000e // b LBB0_5 $56(%rip)
|
||||
LBB0_2:
|
||||
WORD $0x8b010008 // add x8, x0, x1
|
||||
WORD $0x52800029 // mov w9, #1
|
||||
WORD $0xd284c00a // mov x10, #9728
|
||||
WORD $0xf2c0002a // movk x10, #1, lsl #32
|
||||
LBB0_3:
|
||||
WORD $0x3862680b // ldrb w11, [x0, x2]
|
||||
WORD $0x7100817f // cmp w11, #32
|
||||
WORD $0x9acb212b // lsl x11, x9, x11
|
||||
WORD $0x8a0a016b // and x11, x11, x10
|
||||
WORD $0xfa409964 // ccmp x11, #0, #4, ls
|
||||
WORD $0x540000a0 // b.eq LBB0_6 $20(%rip)
|
||||
WORD $0x91000442 // add x2, x2, #1
|
||||
WORD $0xeb02003f // cmp x1, x2
|
||||
WORD $0x54ffff01 // b.ne LBB0_3 $-32(%rip)
|
||||
LBB0_5:
|
||||
WORD $0xcb000102 // sub x2, x8, x0
|
||||
LBB0_6:
|
||||
WORD $0xaa0203e0 // mov x0, x2
|
||||
WORD $0xa940fbfd // ldp fp, lr, [sp, #8]
|
||||
WORD $0x910083ff // add sp, sp, #32
|
||||
WORD $0xd65f03c0 // ret
|
||||
|
||||
TEXT ·__lspace(SB), NOSPLIT, $0-32
|
||||
NO_LOCAL_POINTERS
|
||||
|
||||
_entry:
|
||||
MOVD 16(g), R16
|
||||
SUB $96, RSP, R17
|
||||
CMP R16, R17
|
||||
BLS _stack_grow
|
||||
|
||||
_lspace:
|
||||
MOVD sp+0(FP), R0
|
||||
MOVD nb+8(FP), R1
|
||||
MOVD off+16(FP), R2
|
||||
MOVD ·_subr__lspace(SB), R11
|
||||
WORD $0x1000005e // adr x30, .+8
|
||||
JMP (R11)
|
||||
MOVD R0, ret+24(FP)
|
||||
RET
|
||||
|
||||
_stack_grow:
|
||||
MOVD R30, R3
|
||||
CALL runtime·morestack_noctxt<>(SB)
|
||||
JMP _entry
|
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __lspace_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__lspace uintptr = __lspace_entry__() + 0
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__lspace = 32
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__lspace
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__lspace
|
||||
)
|
@ -0,0 +1,49 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
var (
|
||||
S_f64toa = _subr__f64toa
|
||||
S_f32toa = _subr__f32toa
|
||||
S_i64toa = _subr__i64toa
|
||||
S_u64toa = _subr__u64toa
|
||||
S_lspace = _subr__lspace
|
||||
)
|
||||
|
||||
var (
|
||||
S_quote = _subr__quote
|
||||
S_unquote = _subr__unquote
|
||||
)
|
||||
|
||||
var (
|
||||
S_value = _subr__value
|
||||
S_vstring = _subr__vstring
|
||||
S_vnumber = _subr__vnumber
|
||||
S_vsigned = _subr__vsigned
|
||||
S_vunsigned = _subr__vunsigned
|
||||
)
|
||||
|
||||
var (
|
||||
S_skip_one = _subr__skip_one
|
||||
S_skip_one_fast = _subr__skip_one_fast
|
||||
S_skip_array = _subr__skip_array
|
||||
S_skip_object = _subr__skip_object
|
||||
S_skip_number = _subr__skip_number
|
||||
S_get_by_path = _subr__get_by_path
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
import (
|
||||
`unsafe`
|
||||
|
||||
// `github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
func quote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) (ret int) {
|
||||
return __quote(sp, nb, dp, dn, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __quote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) (ret int)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __quote_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__quote uintptr = __quote_entry__() + 32
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__quote = 32
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__quote
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__quote
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
import (
|
||||
// `unsafe`
|
||||
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
func skip_array(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) {
|
||||
return __skip_array(s, p, m, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_array(s *string, p *int, m *types.StateMachine, flags uint64) (ret int)
|
File diff suppressed because it is too large
Load Diff
25
vendor/github.com/bytedance/sonic/internal/native/neon/skip_array_subr_arm64.go
generated
vendored
25
vendor/github.com/bytedance/sonic/internal/native/neon/skip_array_subr_arm64.go
generated
vendored
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __skip_array_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__skip_array uintptr = __skip_array_entry__() + 48
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__skip_array = 112
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__skip_array
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__skip_array
|
||||
)
|
@ -0,0 +1,31 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
func skip_number(s *string, p *int) (ret int) {
|
||||
return __skip_number(s, p)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_number(s *string, p *int) (ret int)
|
@ -0,0 +1,373 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
#include "go_asm.h"
|
||||
#include "funcdata.h"
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·__skip_number_entry__(SB), NOSPLIT, $32
|
||||
NO_LOCAL_POINTERS
|
||||
WORD $0x100000a0 // adr x0, .+20
|
||||
MOVD R0, ret(FP)
|
||||
RET
|
||||
// .p2align 4, 0x00
|
||||
lCPI0_0:
|
||||
WORD $0x08040201
|
||||
WORD $0x80402010
|
||||
WORD $0x08040201
|
||||
WORD $0x80402010
|
||||
// // .byte 1
|
||||
// .byte 2
|
||||
// .byte 4
|
||||
// .byte 8
|
||||
// .byte 16
|
||||
// .byte 32
|
||||
// .byte 64
|
||||
// .byte 128
|
||||
// .byte 1
|
||||
// .byte 2
|
||||
// .byte 4
|
||||
// .byte 8
|
||||
// .byte 16
|
||||
// .byte 32
|
||||
// .byte 64
|
||||
// .byte 128
|
||||
|
||||
lCPI0_1:
|
||||
WORD $0x09010800
|
||||
WORD $0x0b030a02
|
||||
WORD $0x0d050c04
|
||||
WORD $0x0f070e06
|
||||
// // .byte 0
|
||||
// .byte 8
|
||||
// .byte 1
|
||||
// .byte 9
|
||||
// .byte 2
|
||||
// .byte 10
|
||||
// .byte 3
|
||||
// .byte 11
|
||||
// .byte 4
|
||||
// .byte 12
|
||||
// .byte 5
|
||||
// .byte 13
|
||||
// .byte 6
|
||||
// .byte 14
|
||||
// .byte 7
|
||||
// .byte 15
|
||||
|
||||
_skip_number:
|
||||
WORD $0xd100c3ff // sub sp, sp, #48
|
||||
WORD $0xa900cff4 // stp x20, x19, [sp, #8]
|
||||
WORD $0xa901fbfd // stp fp, lr, [sp, #24]
|
||||
WORD $0xa93ffbfd // stp fp, lr, [sp, #-8]
|
||||
WORD $0xd10023fd // sub fp, sp, #8
|
||||
WORD $0xaa0003e8 // mov x8, x0
|
||||
WORD $0xf9400020 // ldr x0, [x1]
|
||||
WORD $0xa9402909 // ldp x9, x10, [x8]
|
||||
WORD $0x8b000128 // add x8, x9, x0
|
||||
WORD $0xaa0803eb // mov x11, x8
|
||||
WORD $0x3840156c // ldrb w12, [x11], #1
|
||||
WORD $0x7100b59f // cmp w12, #45
|
||||
WORD $0x1a9f17ed // cset w13, eq
|
||||
WORD $0x9a8b1108 // csel x8, x8, x11, ne
|
||||
WORD $0xcb00014a // sub x10, x10, x0
|
||||
WORD $0xeb0d014e // subs x14, x10, x13
|
||||
WORD $0x54001c40 // b.eq LBB0_59 $904(%rip)
|
||||
WORD $0x3940010a // ldrb w10, [x8]
|
||||
WORD $0x5100e94b // sub w11, w10, #58
|
||||
WORD $0x3100297f // cmn w11, #10
|
||||
WORD $0x540017a3 // b.lo LBB0_52 $756(%rip)
|
||||
WORD $0x7100c15f // cmp w10, #48
|
||||
WORD $0x540001e1 // b.ne LBB0_6 $60(%rip)
|
||||
WORD $0xf10005df // cmp x14, #1
|
||||
WORD $0x54000061 // b.ne LBB0_5 $12(%rip)
|
||||
LBB0_4:
|
||||
WORD $0x5280002d // mov w13, #1
|
||||
WORD $0x140000a9 // b LBB0_47 $676(%rip)
|
||||
LBB0_5:
|
||||
WORD $0x3940050a // ldrb w10, [x8, #1]
|
||||
WORD $0x5100b94a // sub w10, w10, #46
|
||||
WORD $0x7100dd5f // cmp w10, #55
|
||||
WORD $0x5280002b // mov w11, #1
|
||||
WORD $0x9aca216a // lsl x10, x11, x10
|
||||
WORD $0xb20903eb // mov x11, #36028797027352576
|
||||
WORD $0xf280002b // movk x11, #1
|
||||
WORD $0x8a0b014a // and x10, x10, x11
|
||||
WORD $0xfa409944 // ccmp x10, #0, #4, ls
|
||||
WORD $0x54fffea0 // b.eq LBB0_4 $-44(%rip)
|
||||
LBB0_6:
|
||||
WORD $0xf10041df // cmp x14, #16
|
||||
WORD $0x54001a63 // b.lo LBB0_60 $844(%rip)
|
||||
WORD $0xd2800010 // mov x16, #0
|
||||
WORD $0xd280000f // mov x15, #0
|
||||
WORD $0x9280000a // mov x10, #-1
|
||||
WORD $0x4f01e5c0 // movi.16b v0, #46
|
||||
WORD $0x4f01e561 // movi.16b v1, #43
|
||||
WORD $0x4f01e5a2 // movi.16b v2, #45
|
||||
WORD $0x4f06e603 // movi.16b v3, #208
|
||||
WORD $0x4f00e544 // movi.16b v4, #10
|
||||
Lloh0:
|
||||
WORD $0x10fff92b // adr x11, lCPI0_0 $-220(%rip)
|
||||
Lloh1:
|
||||
WORD $0x3dc00165 // ldr q5, [x11, lCPI0_0@PAGEOFF] $0(%rip)
|
||||
WORD $0x4f06e7e6 // movi.16b v6, #223
|
||||
WORD $0x4f02e4a7 // movi.16b v7, #69
|
||||
Lloh2:
|
||||
WORD $0x10fff92b // adr x11, lCPI0_1 $-220(%rip)
|
||||
Lloh3:
|
||||
WORD $0x3dc00170 // ldr q16, [x11, lCPI0_1@PAGEOFF] $0(%rip)
|
||||
WORD $0x12800011 // mov w17, #-1
|
||||
WORD $0x9280000c // mov x12, #-1
|
||||
WORD $0x9280000b // mov x11, #-1
|
||||
LBB0_8:
|
||||
WORD $0x3cef6911 // ldr q17, [x8, x15]
|
||||
WORD $0x6e208e32 // cmeq.16b v18, v17, v0
|
||||
WORD $0x6e218e33 // cmeq.16b v19, v17, v1
|
||||
WORD $0x6e228e34 // cmeq.16b v20, v17, v2
|
||||
WORD $0x4e238635 // add.16b v21, v17, v3
|
||||
WORD $0x6e353495 // cmhi.16b v21, v4, v21
|
||||
WORD $0x4e261e31 // and.16b v17, v17, v6
|
||||
WORD $0x6e278e31 // cmeq.16b v17, v17, v7
|
||||
WORD $0x4eb41e73 // orr.16b v19, v19, v20
|
||||
WORD $0x4eb21eb4 // orr.16b v20, v21, v18
|
||||
WORD $0x4eb31e35 // orr.16b v21, v17, v19
|
||||
WORD $0x4eb51e94 // orr.16b v20, v20, v21
|
||||
WORD $0x4e251e52 // and.16b v18, v18, v5
|
||||
WORD $0x4e100252 // tbl.16b v18, { v18 }, v16
|
||||
WORD $0x4e71ba52 // addv.8h h18, v18
|
||||
WORD $0x1e260243 // fmov w3, s18
|
||||
WORD $0x4e251e31 // and.16b v17, v17, v5
|
||||
WORD $0x4e100231 // tbl.16b v17, { v17 }, v16
|
||||
WORD $0x4e71ba31 // addv.8h h17, v17
|
||||
WORD $0x1e260224 // fmov w4, s17
|
||||
WORD $0x4e251e71 // and.16b v17, v19, v5
|
||||
WORD $0x4e100231 // tbl.16b v17, { v17 }, v16
|
||||
WORD $0x4e71ba31 // addv.8h h17, v17
|
||||
WORD $0x1e260226 // fmov w6, s17
|
||||
WORD $0x4e251e91 // and.16b v17, v20, v5
|
||||
WORD $0x4e100231 // tbl.16b v17, { v17 }, v16
|
||||
WORD $0x4e71ba31 // addv.8h h17, v17
|
||||
WORD $0x1e260222 // fmov w2, s17
|
||||
WORD $0x2a2203e2 // mvn w2, w2
|
||||
WORD $0x32103c42 // orr w2, w2, #0xffff0000
|
||||
WORD $0x5ac00042 // rbit w2, w2
|
||||
WORD $0x5ac01042 // clz w2, w2
|
||||
WORD $0x1ac22225 // lsl w5, w17, w2
|
||||
WORD $0x0a250067 // bic w7, w3, w5
|
||||
WORD $0x0a250093 // bic w19, w4, w5
|
||||
WORD $0x0a2500d4 // bic w20, w6, w5
|
||||
WORD $0x7100405f // cmp w2, #16
|
||||
WORD $0x1a870065 // csel w5, w3, w7, eq
|
||||
WORD $0x1a930084 // csel w4, w4, w19, eq
|
||||
WORD $0x1a9400c3 // csel w3, w6, w20, eq
|
||||
WORD $0x510004a6 // sub w6, w5, #1
|
||||
WORD $0x6a0500c6 // ands w6, w6, w5
|
||||
WORD $0x54001041 // b.ne LBB0_55 $520(%rip)
|
||||
WORD $0x51000486 // sub w6, w4, #1
|
||||
WORD $0x6a0400c6 // ands w6, w6, w4
|
||||
WORD $0x54000fe1 // b.ne LBB0_55 $508(%rip)
|
||||
WORD $0x51000466 // sub w6, w3, #1
|
||||
WORD $0x6a0300c6 // ands w6, w6, w3
|
||||
WORD $0x54000f81 // b.ne LBB0_55 $496(%rip)
|
||||
WORD $0x340000c5 // cbz w5, LBB0_14 $24(%rip)
|
||||
WORD $0x5ac000a5 // rbit w5, w5
|
||||
WORD $0x5ac010a5 // clz w5, w5
|
||||
WORD $0xb100057f // cmn x11, #1
|
||||
WORD $0x54000f81 // b.ne LBB0_56 $496(%rip)
|
||||
WORD $0x8b0501eb // add x11, x15, x5
|
||||
LBB0_14:
|
||||
WORD $0x340000c4 // cbz w4, LBB0_17 $24(%rip)
|
||||
WORD $0x5ac00084 // rbit w4, w4
|
||||
WORD $0x5ac01084 // clz w4, w4
|
||||
WORD $0xb100059f // cmn x12, #1
|
||||
WORD $0x54000f21 // b.ne LBB0_57 $484(%rip)
|
||||
WORD $0x8b0401ec // add x12, x15, x4
|
||||
LBB0_17:
|
||||
WORD $0x340000c3 // cbz w3, LBB0_20 $24(%rip)
|
||||
WORD $0x5ac00063 // rbit w3, w3
|
||||
WORD $0x5ac01063 // clz w3, w3
|
||||
WORD $0xb100055f // cmn x10, #1
|
||||
WORD $0x54000ec1 // b.ne LBB0_58 $472(%rip)
|
||||
WORD $0x8b0301ea // add x10, x15, x3
|
||||
LBB0_20:
|
||||
WORD $0x7100405f // cmp w2, #16
|
||||
WORD $0x54000621 // b.ne LBB0_35 $196(%rip)
|
||||
WORD $0x910041ef // add x15, x15, #16
|
||||
WORD $0xd1004210 // sub x16, x16, #16
|
||||
WORD $0x8b1001c2 // add x2, x14, x16
|
||||
WORD $0xf1003c5f // cmp x2, #15
|
||||
WORD $0x54fff6e8 // b.hi LBB0_8 $-292(%rip)
|
||||
WORD $0x8b0f0110 // add x16, x8, x15
|
||||
WORD $0xeb0f01df // cmp x14, x15
|
||||
WORD $0x54000560 // b.eq LBB0_36 $172(%rip)
|
||||
LBB0_23:
|
||||
WORD $0x8b02020e // add x14, x16, x2
|
||||
WORD $0xaa3003ef // mvn x15, x16
|
||||
WORD $0x8b090011 // add x17, x0, x9
|
||||
WORD $0x8b1101ef // add x15, x15, x17
|
||||
WORD $0x8b0d01ed // add x13, x15, x13
|
||||
WORD $0xcb08020f // sub x15, x16, x8
|
||||
WORD $0xaa1003f1 // mov x17, x16
|
||||
WORD $0x14000009 // b LBB0_26 $36(%rip)
|
||||
LBB0_24:
|
||||
WORD $0xb100059f // cmn x12, #1
|
||||
WORD $0xaa0f03ec // mov x12, x15
|
||||
WORD $0x54000661 // b.ne LBB0_46 $204(%rip)
|
||||
LBB0_25:
|
||||
WORD $0xd10005ad // sub x13, x13, #1
|
||||
WORD $0x910005ef // add x15, x15, #1
|
||||
WORD $0xaa1103f0 // mov x16, x17
|
||||
WORD $0xd1000442 // sub x2, x2, #1
|
||||
WORD $0xb4000882 // cbz x2, LBB0_53 $272(%rip)
|
||||
LBB0_26:
|
||||
WORD $0x38401623 // ldrb w3, [x17], #1
|
||||
WORD $0x5100c064 // sub w4, w3, #48
|
||||
WORD $0x7100289f // cmp w4, #10
|
||||
WORD $0x54ffff03 // b.lo LBB0_25 $-32(%rip)
|
||||
WORD $0x7100b47f // cmp w3, #45
|
||||
WORD $0x5400016d // b.le LBB0_32 $44(%rip)
|
||||
WORD $0x7101947f // cmp w3, #101
|
||||
WORD $0x54fffe20 // b.eq LBB0_24 $-60(%rip)
|
||||
WORD $0x7101147f // cmp w3, #69
|
||||
WORD $0x54fffde0 // b.eq LBB0_24 $-68(%rip)
|
||||
WORD $0x7100b87f // cmp w3, #46
|
||||
WORD $0x540001e1 // b.ne LBB0_36 $60(%rip)
|
||||
WORD $0xb100057f // cmn x11, #1
|
||||
WORD $0xaa0f03eb // mov x11, x15
|
||||
WORD $0x54fffda0 // b.eq LBB0_25 $-76(%rip)
|
||||
WORD $0x1400001e // b LBB0_46 $120(%rip)
|
||||
LBB0_32:
|
||||
WORD $0x7100ac7f // cmp w3, #43
|
||||
WORD $0x54000060 // b.eq LBB0_34 $12(%rip)
|
||||
WORD $0x7100b47f // cmp w3, #45
|
||||
WORD $0x540000e1 // b.ne LBB0_36 $28(%rip)
|
||||
LBB0_34:
|
||||
WORD $0xb100055f // cmn x10, #1
|
||||
WORD $0xaa0f03ea // mov x10, x15
|
||||
WORD $0x54fffca0 // b.eq LBB0_25 $-108(%rip)
|
||||
WORD $0x14000016 // b LBB0_46 $88(%rip)
|
||||
LBB0_35:
|
||||
WORD $0x8b22410d // add x13, x8, w2, uxtw
|
||||
WORD $0x8b0f01b0 // add x16, x13, x15
|
||||
LBB0_36:
|
||||
WORD $0x9280000d // mov x13, #-1
|
||||
WORD $0xb40003eb // cbz x11, LBB0_51 $124(%rip)
|
||||
LBB0_37:
|
||||
WORD $0xb40003ca // cbz x10, LBB0_51 $120(%rip)
|
||||
WORD $0xb40003ac // cbz x12, LBB0_51 $116(%rip)
|
||||
WORD $0xcb08020d // sub x13, x16, x8
|
||||
WORD $0xd10005ae // sub x14, x13, #1
|
||||
WORD $0xeb0e017f // cmp x11, x14
|
||||
WORD $0x54000160 // b.eq LBB0_45 $44(%rip)
|
||||
WORD $0xeb0e015f // cmp x10, x14
|
||||
WORD $0x54000120 // b.eq LBB0_45 $36(%rip)
|
||||
WORD $0xeb0e019f // cmp x12, x14
|
||||
WORD $0x540000e0 // b.eq LBB0_45 $28(%rip)
|
||||
WORD $0xf100054e // subs x14, x10, #1
|
||||
WORD $0x540001cb // b.lt LBB0_48 $56(%rip)
|
||||
WORD $0xeb0e019f // cmp x12, x14
|
||||
WORD $0x54000180 // b.eq LBB0_48 $48(%rip)
|
||||
WORD $0xaa2a03ed // mvn x13, x10
|
||||
WORD $0x1400000f // b LBB0_51 $60(%rip)
|
||||
LBB0_45:
|
||||
WORD $0xcb0d03ed // neg x13, x13
|
||||
LBB0_46:
|
||||
WORD $0xb7f801ad // tbnz x13, #63, LBB0_51 $52(%rip)
|
||||
LBB0_47:
|
||||
WORD $0x8b0d0108 // add x8, x8, x13
|
||||
WORD $0xcb090108 // sub x8, x8, x9
|
||||
WORD $0xf9000028 // str x8, [x1]
|
||||
WORD $0xa941fbfd // ldp fp, lr, [sp, #24]
|
||||
WORD $0xa940cff4 // ldp x20, x19, [sp, #8]
|
||||
WORD $0x9100c3ff // add sp, sp, #48
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_48:
|
||||
WORD $0xaa0c016a // orr x10, x11, x12
|
||||
WORD $0xb7f8022a // tbnz x10, #63, LBB0_54 $68(%rip)
|
||||
WORD $0xeb0c017f // cmp x11, x12
|
||||
WORD $0x540001eb // b.lt LBB0_54 $60(%rip)
|
||||
WORD $0xaa2b03ed // mvn x13, x11
|
||||
LBB0_51:
|
||||
WORD $0xaa2d03ea // mvn x10, x13
|
||||
WORD $0x8b0a0108 // add x8, x8, x10
|
||||
LBB0_52:
|
||||
WORD $0x92800020 // mov x0, #-2
|
||||
WORD $0xcb090108 // sub x8, x8, x9
|
||||
WORD $0xf9000028 // str x8, [x1]
|
||||
WORD $0xa941fbfd // ldp fp, lr, [sp, #24]
|
||||
WORD $0xa940cff4 // ldp x20, x19, [sp, #8]
|
||||
WORD $0x9100c3ff // add sp, sp, #48
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_53:
|
||||
WORD $0xaa0e03f0 // mov x16, x14
|
||||
WORD $0x9280000d // mov x13, #-1
|
||||
WORD $0xb5fffaeb // cbnz x11, LBB0_37 $-164(%rip)
|
||||
WORD $0x17fffff4 // b LBB0_51 $-48(%rip)
|
||||
LBB0_54:
|
||||
WORD $0xd37ffd4a // lsr x10, x10, #63
|
||||
WORD $0x5200014a // eor w10, w10, #0x1
|
||||
WORD $0xd100058e // sub x14, x12, #1
|
||||
WORD $0xeb0e017f // cmp x11, x14
|
||||
WORD $0x1a9f17eb // cset w11, eq
|
||||
WORD $0x6a0b015f // tst w10, w11
|
||||
WORD $0xda8c01ad // csinv x13, x13, x12, eq
|
||||
WORD $0x17ffffdf // b LBB0_46 $-132(%rip)
|
||||
LBB0_55:
|
||||
WORD $0x5ac000ca // rbit w10, w6
|
||||
WORD $0x5ac0114a // clz w10, w10
|
||||
WORD $0xaa2f03eb // mvn x11, x15
|
||||
WORD $0xcb0a016d // sub x13, x11, x10
|
||||
WORD $0x17ffffda // b LBB0_46 $-152(%rip)
|
||||
LBB0_56:
|
||||
WORD $0xaa2f03ea // mvn x10, x15
|
||||
WORD $0xcb25414d // sub x13, x10, w5, uxtw
|
||||
WORD $0x17ffffd7 // b LBB0_46 $-164(%rip)
|
||||
LBB0_57:
|
||||
WORD $0xaa2f03ea // mvn x10, x15
|
||||
WORD $0xcb24414d // sub x13, x10, w4, uxtw
|
||||
WORD $0x17ffffd4 // b LBB0_46 $-176(%rip)
|
||||
LBB0_58:
|
||||
WORD $0xaa2f03ea // mvn x10, x15
|
||||
WORD $0xcb23414d // sub x13, x10, w3, uxtw
|
||||
WORD $0x17ffffd1 // b LBB0_46 $-188(%rip)
|
||||
LBB0_59:
|
||||
WORD $0x92800000 // mov x0, #-1
|
||||
WORD $0xcb090108 // sub x8, x8, x9
|
||||
WORD $0xf9000028 // str x8, [x1]
|
||||
WORD $0xa941fbfd // ldp fp, lr, [sp, #24]
|
||||
WORD $0xa940cff4 // ldp x20, x19, [sp, #8]
|
||||
WORD $0x9100c3ff // add sp, sp, #48
|
||||
WORD $0xd65f03c0 // ret
|
||||
LBB0_60:
|
||||
WORD $0x9280000b // mov x11, #-1
|
||||
WORD $0xaa0803f0 // mov x16, x8
|
||||
WORD $0xaa0e03e2 // mov x2, x14
|
||||
WORD $0x9280000c // mov x12, #-1
|
||||
WORD $0x9280000a // mov x10, #-1
|
||||
WORD $0x17ffff87 // b LBB0_23 $-484(%rip)
|
||||
// .p2align 2, 0x00
|
||||
_MASK_USE_NUMBER:
|
||||
WORD $0x00000002 // .long 2
|
||||
|
||||
TEXT ·__skip_number(SB), NOSPLIT, $0-24
|
||||
NO_LOCAL_POINTERS
|
||||
|
||||
_entry:
|
||||
MOVD 16(g), R16
|
||||
SUB $112, RSP, R17
|
||||
CMP R16, R17
|
||||
BLS _stack_grow
|
||||
|
||||
_skip_number:
|
||||
MOVD s+0(FP), R0
|
||||
MOVD p+8(FP), R1
|
||||
MOVD ·_subr__skip_number(SB), R11
|
||||
WORD $0x1000005e // adr x30, .+8
|
||||
JMP (R11)
|
||||
MOVD R0, ret+16(FP)
|
||||
RET
|
||||
|
||||
_stack_grow:
|
||||
MOVD R30, R3
|
||||
CALL runtime·morestack_noctxt<>(SB)
|
||||
JMP _entry
|
25
vendor/github.com/bytedance/sonic/internal/native/neon/skip_number_subr_arm64.go
generated
vendored
25
vendor/github.com/bytedance/sonic/internal/native/neon/skip_number_subr_arm64.go
generated
vendored
@ -0,0 +1,25 @@
|
||||
// +build !noasm !appengine
|
||||
// Code generated by asm2asm, DO NOT EDIT.
|
||||
|
||||
package neon
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __skip_number_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__skip_number uintptr = __skip_number_entry__() + 32
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__skip_number = 48
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__skip_number
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__skip_number
|
||||
)
|
@ -0,0 +1,37 @@
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
// Code generated by Makefile, DO NOT EDIT.
|
||||
|
||||
/*
|
||||
* Copyright 2021 ByteDance Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package neon
|
||||
|
||||
import (
|
||||
// `unsafe`
|
||||
|
||||
`github.com/bytedance/sonic/internal/native/types`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
func skip_object(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) {
|
||||
return __skip_object(s, p, m, flags)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __skip_object(s *string, p *int, m *types.StateMachine, flags uint64) (ret int)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue