-
Notifications
You must be signed in to change notification settings - Fork 2
/
PyLong.go
35 lines (32 loc) · 761 Bytes
/
PyLong.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package py3
import (
"github.com/aadog/py3-go/cpy3"
"unsafe"
)
type PyLong struct {
PyObject
}
// PyLongFromInst
// 新建一个对象来自已经存在的对象实例指针。
//
// Create a new object from an existing object instance pointer.
func PyLongFromInst(inst uintptr) *PyLong {
dl := new(PyLong)
dl.instance = inst
dl.ptr = unsafe.Pointer(dl.instance)
return dl
}
func PyLongFromObj(obj *PyObject) *PyLong {
dl := new(PyLong)
dl.PyObject = *obj
return dl
}
func PyLongFromLong(n int) *PyLong {
return PyLongFromInst(cpy3.PyLong_FromLong(n))
}
func PyLongFromLongLong(n int64) *PyLong {
return PyLongFromInst(cpy3.PyLong_FromLongLong(n))
}
func PyLong_FromDouble(n float64) *PyLong {
return PyLongFromInst(cpy3.PyLong_FromDouble(n))
}