-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathIntType.hh
More file actions
42 lines (36 loc) · 1.07 KB
/
IntType.hh
File metadata and controls
42 lines (36 loc) · 1.07 KB
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
36
37
38
39
40
41
42
/**
* @file IntType.hh
* @author Caleb Aikens (caleb@distributive.network), Giovanni Tedesco (giovanni@distributive.network), Tom Tang (xmader@distributive.network) and Philippe Laporte (philippe@distributive.network)
* @brief Struct for representing python ints
* @date 2023-03-16
*
* @copyright Copyright (c) 2023,2024 Distributive Corp.
*
*/
#ifndef PythonMonkey_IntType_
#define PythonMonkey_IntType_
#include <jsapi.h>
#include <Python.h>
/**
* @brief This struct represents the 'int' type (arbitrary-precision) in Python
*/
struct IntType {
public:
/**
* @brief Construct a new PyObject from a JS::BigInt.
*
* @param cx - javascript context pointer
* @param bigint - JS::BigInt pointer
*
* @returns PyObject* pointer to the resulting PyObject
*/
static PyObject *getPyObject(JSContext *cx, JS::BigInt *bigint);
/**
* @brief Convert an int object to a JS::BigInt
*
* @param cx - javascript context pointer
* @param pyObject - the int object to be converted
*/
static JS::BigInt *toJsBigInt(JSContext *cx, PyObject *pyObject);
};
#endif