Treat bool specially, avoid allocation
Because bool as a PyObject won't have a normal destroy operation
This commit is contained in:
parent
306dcf5bac
commit
968b099dab
|
@ -1,13 +1,12 @@
|
||||||
%module ckzg
|
%module ckzg
|
||||||
%include "stdint.i"
|
|
||||||
%include "carrays.i"
|
|
||||||
%include "cpointer.i"
|
|
||||||
%{
|
%{
|
||||||
#include <stdbool.h>
|
|
||||||
#include "c_kzg.h"
|
#include "c_kzg.h"
|
||||||
#include "bls12_381.h"
|
#include "bls12_381.h"
|
||||||
#include "test_util.h"
|
#include "test_util.h"
|
||||||
%}
|
%}
|
||||||
|
%include "stdint.i"
|
||||||
|
%include "carrays.i"
|
||||||
|
%include "cpointer.i"
|
||||||
%rename(alloc_poly) new_poly;
|
%rename(alloc_poly) new_poly;
|
||||||
%rename(alloc_poly_l) new_poly_l;
|
%rename(alloc_poly_l) new_poly_l;
|
||||||
|
|
||||||
|
@ -24,6 +23,13 @@
|
||||||
FFTSettings *out, KZGSettings *out
|
FFTSettings *out, KZGSettings *out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(in, numinputs=0) bool *OUTPUT(bool tmp) { $1 = &tmp; }
|
||||||
|
%typemap(argout) bool *OUTPUT {
|
||||||
|
PyObject *obj = *$1 ? Py_True : Py_False;
|
||||||
|
$result = ($result == NULL) ? obj : SWIG_Python_AppendOutput($result, obj);
|
||||||
|
}
|
||||||
|
%apply bool *OUTPUT { bool *out }
|
||||||
|
|
||||||
%typemap(in, numinputs=0) uint64_t out[4] (uint64_t tmp[4]) { $1 = tmp; }
|
%typemap(in, numinputs=0) uint64_t out[4] (uint64_t tmp[4]) { $1 = tmp; }
|
||||||
%typemap(argout) uint64_t out[4] {
|
%typemap(argout) uint64_t out[4] {
|
||||||
PyObject *obj = PyTuple_Pack(4,
|
PyObject *obj = PyTuple_Pack(4,
|
||||||
|
|
Loading…
Reference in New Issue