// Code generated by modernc.org/undup from the per-target sqlite_*.go files; DO NOT EDIT. //go:build (darwin && amd64) || (darwin && arm64) || (freebsd && amd64) || (linux && amd64) || (linux && arm64) || (linux && loong64) || (linux && ppc64le) || (linux && riscv64) || (linux && s390x) || (netbsd && amd64) || (openbsd && amd64) || (openbsd && arm64) package sqlite3 import ( "modernc.org/libc" ) // C documentation // // /* // ** Function: geopoly_regular(X,Y,R,N) // ** // ** Construct a simple, convex, regular polygon centered at X, Y // ** with circumradius R and with N sides. // */ func _geopolyRegularFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { bp := tls.Alloc(16) defer tls.Free(16) var n int32 var p uintptr var r, rAngle, x, y float64 var _ /* i at bp+0 */ int32 _, _, _, _, _, _ = n, p, r, rAngle, x, y x = Xsqlite3_value_double(tls, **(**uintptr)(__ccgo_up(argv))) y = Xsqlite3_value_double(tls, **(**uintptr)(__ccgo_up(argv + 1*8))) r = Xsqlite3_value_double(tls, **(**uintptr)(__ccgo_up(argv + 2*8))) n = Xsqlite3_value_int(tls, **(**uintptr)(__ccgo_up(argv + 3*8))) _ = argc if n < int32(3) || r <= float64(0) { return } if n > int32(1000) { n = int32(1000) } p = Xsqlite3_malloc64(tls, uint64(uint64(40)+libc.Uint64FromInt32((n-int32(1))*int32(2))*uint64(4))) if p == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return } **(**int32)(__ccgo_up(bp)) = int32(1) **(**uint8)(__ccgo_up(p + 4)) = **(**uint8)(__ccgo_up(bp)) **(**uint8)(__ccgo_up(p + 4 + 1)) = uint8(0) **(**uint8)(__ccgo_up(p + 4 + 2)) = libc.Uint8FromInt32(n >> int32(8) & int32(0xff)) **(**uint8)(__ccgo_up(p + 4 + 3)) = libc.Uint8FromInt32(n & int32(0xff)) **(**int32)(__ccgo_up(bp)) = 0 for { if !(**(**int32)(__ccgo_up(bp)) < n) { break } rAngle = float64(float64(libc.Float64FromFloat64(2)*libc.Float64FromFloat64(3.141592653589793))*float64(**(**int32)(__ccgo_up(bp)))) / float64(n) **(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(**(**int32)(__ccgo_up(bp))*int32(2))*4)) = float32(x - float64(r*_geopolySine(tls, rAngle-float64(libc.Float64FromFloat64(0.5)*libc.Float64FromFloat64(3.141592653589793))))) **(**TGeoCoord)(__ccgo_up(p + 8 + uintptr(**(**int32)(__ccgo_up(bp))*int32(2)+int32(1))*4)) = float32(y + float64(r*_geopolySine(tls, rAngle))) goto _1 _1: ; **(**int32)(__ccgo_up(bp)) = **(**int32)(__ccgo_up(bp)) + 1 } Xsqlite3_result_blob(tls, context, p+4, int32(4)+int32(8)*n, uintptr(-libc.Int32FromInt32(1))) Xsqlite3_free(tls, p) }