package sqlite3_wasm
import (
"bytes"
"math"
"strconv"
"time"
"unsafe"
)
func (m *Module ) _acos (x float64 ) float64 { return math .Acos (x ) }
func (m *Module ) _acosh (x float64 ) float64 { return math .Acosh (x ) }
func (m *Module ) _asin (x float64 ) float64 { return math .Asin (x ) }
func (m *Module ) _asinh (x float64 ) float64 { return math .Asinh (x ) }
func (m *Module ) _atan (x float64 ) float64 { return math .Atan (x ) }
func (m *Module ) _atan2 (y , x float64 ) float64 { return math .Atan2 (y , x ) }
func (m *Module ) _atanh (x float64 ) float64 { return math .Atanh (x ) }
func (m *Module ) _cos (x float64 ) float64 { return math .Cos (x ) }
func (m *Module ) _cosh (x float64 ) float64 { return math .Cosh (x ) }
func (m *Module ) _exp (x float64 ) float64 { return math .Exp (x ) }
func (m *Module ) _fmod (x , y float64 ) float64 { return math .Mod (x , y ) }
func (m *Module ) _localtime_r (timer , buf int32 ) int32 {
const size = 32 / 8
t := load64 ((*m .memory )[uint32 (timer ):])
m ._storetime_r ((*m .memory )[uint32 (buf ):], time .Unix (int64 (t ), 0 ))
return buf
}
func (m *Module ) _log (x float64 ) float64 { return math .Log (x ) }
func (m *Module ) _log10 (x float64 ) float64 { return math .Log10 (x ) }
func (m *Module ) _log2 (x float64 ) float64 { return math .Log2 (x ) }
func (m *Module ) _memchr (s , c , n int32 ) int32 {
b := (*m .memory )[uint32 (s ):]
if uint (len (b )) > uint (uint32 (n )) {
b = b [:uint32 (n )]
}
if i := bytes .IndexByte (b , byte (c )); i >= 0 {
return s + int32 (i )
}
return 0
}
func (m *Module ) _memcmp (s1 , s2 , n int32 ) int32 {
e1 , e2 := s1 +n , s2 +n
b1 := (*m .memory )[uint32 (s1 ):uint32 (e1 )]
b2 := (*m .memory )[uint32 (s2 ):uint32 (e2 )]
return int32 (bytes .Compare (b1 , b2 ))
}
func (m *Module ) _pow (x , y float64 ) float64 { return math .Pow (x , y ) }
func (m *Module ) _sin (x float64 ) float64 { return math .Sin (x ) }
func (m *Module ) _sinh (x float64 ) float64 { return math .Sinh (x ) }
func (m *Module ) _strchr (s , c int32 ) int32 {
s = m ._strchrnul (s , c )
if (*m .memory )[uint32 (s )] == byte (c ) {
return s
}
return 0
}
func (m *Module ) _strchrnul (s , c int32 ) int32 {
b := (*m .memory )[uint32 (s ):]
b = b [:bytes .IndexByte (b , 0 )]
sz := len (b )
if c := byte (c ); c != 0 {
if i := bytes .IndexByte (b , c ); i >= 0 {
sz = i
}
}
return s + int32 (sz )
}
func (m *Module ) _strcmp (s1 , s2 int32 ) int32 {
b1 := (*m .memory )[uint32 (s1 ):]
b2 := (*m .memory )[uint32 (s2 ):]
sz := min (len (b1 ), len (b2 ))
if i := bytes .IndexByte (b1 [:sz ], 0 ); i >= 0 {
sz = i + 1
}
return int32 (bytes .Compare (b1 [:sz ], b2 [:sz ]))
}
func (m *Module ) _strcpy (d , s int32 ) int32 {
b := (*m .memory )[uint32 (s ):]
b = b [:bytes .IndexByte (b , 0 )+1 ]
copy ((*m .memory )[uint32 (d ):], b )
return d
}
func (m *Module ) _strcspn (s , reject int32 ) int32 {
b := (*m .memory )[uint32 (s ):]
r := (*m .memory )[uint32 (reject ):]
r = r [:bytes .IndexByte (r , 0 )+1 ]
for i , b := range b {
if bytes .IndexByte (r , b ) >= 0 {
return int32 (i )
}
}
return int32 (len (b ))
}
func (m *Module ) _strlen (s int32 ) int32 {
return int32 (bytes .IndexByte ((*m .memory )[uint32 (s ):], 0 ))
}
func (m *Module ) _strncmp (s1 , s2 , n int32 ) int32 {
b1 := (*m .memory )[uint32 (s1 ):]
b2 := (*m .memory )[uint32 (s2 ):]
sz := int (min (uint (len (b1 )), uint (len (b2 )), uint (uint32 (n ))))
if i := bytes .IndexByte (b1 [:sz ], 0 ); i >= 0 {
sz = i + 1
}
return int32 (bytes .Compare (b1 [:sz ], b2 [:sz ]))
}
func (m *Module ) _strrchr (s , c int32 ) int32 {
b := (*m .memory )[uint32 (s ):]
b = b [:bytes .IndexByte (b , 0 )+1 ]
if i := bytes .LastIndexByte (b , byte (c )); i >= 0 {
return s + int32 (i )
}
return 0
}
func (m *Module ) _strspn (s , accept int32 ) int32 {
b := (*m .memory )[uint32 (s ):]
a := (*m .memory )[uint32 (accept ):]
a = a [:bytes .IndexByte (a , 0 )]
for i , b := range b {
if bytes .IndexByte (a , b ) < 0 {
return int32 (i )
}
}
return int32 (len (b ))
}
func (m *Module ) _strstr (haystack , needle int32 ) int32 {
h := (*m .memory )[uint32 (haystack ):]
n := (*m .memory )[uint32 (needle ):]
h = h [:bytes .IndexByte (h , 0 )]
n = n [:bytes .IndexByte (n , 0 )]
i := bytes .Index (h , n )
if i < 0 {
return 0
}
return haystack + int32 (i )
}
func (m *Module ) _strtol (s , endptr int32 , base int32 ) int32 {
m0 := (*m .memory )[uint32 (s ):]
m1 := bytes .TrimLeft (m0 , " \t\n\v\f\r" )
m2 := bytes .TrimLeft (m1 , "+-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
spaces := len (m0 ) - len (m1 )
digits := len (m1 ) - len (m2 )
var val int64
for ; digits > 0 ; digits -- {
var err error
str := unsafe .String (&m1 [0 ], digits )
val , err = strconv .ParseInt (str , int (base ), 32 )
if e , ok := err .(*strconv .NumError ); !ok || e .Err == strconv .ErrRange {
break
}
}
if endptr != 0 {
if digits > 0 {
s += int32 (spaces + digits )
}
store32 ((*m .memory )[uint32 (endptr ):], uint32 (s ))
}
return int32 (val )
}
func (m *Module ) _tan (x float64 ) float64 { return math .Tan (x ) }
func (m *Module ) _tanh (x float64 ) float64 { return math .Tanh (x ) }
func (m *Module ) _storetime_r (buf []byte , t time .Time ) {
const size = 32 / 8
var isdst uint32
if t .IsDST () {
isdst = 1
}
store32 (buf [0 *size :], uint32 (t .Second ()))
store32 (buf [1 *size :], uint32 (t .Minute ()))
store32 (buf [2 *size :], uint32 (t .Hour ()))
store32 (buf [3 *size :], uint32 (t .Day ()))
store32 (buf [4 *size :], uint32 (t .Month ()-time .January ))
store32 (buf [5 *size :], uint32 (t .Year ()-1900 ))
store32 (buf [6 *size :], uint32 (t .Weekday ()-time .Sunday ))
store32 (buf [7 *size :], uint32 (t .YearDay ()-1 ))
store32 (buf [8 *size :], isdst )
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .