| 1 |
/* |
| 2 |
* perl_math_int64.h - This file is in the public domain |
| 3 |
* Author: Salvador Fandino <[email protected]> |
| 4 |
* Version: 2.1 |
| 5 |
* |
| 6 |
* Generated on: 2014-10-30 11:43:56 |
| 7 |
* Math::Int64 version: 0.33 |
| 8 |
* Module::CAPIMaker version: 0.02 |
| 9 |
*/ |
| 10 |
|
| 11 |
/* Platypus specific begin */ |
| 12 |
#ifdef HAVE_IV_IS_64 |
| 13 |
#define SvU64(a) SvUV(a) |
| 14 |
#define SvI64(a) SvIV(a) |
| 15 |
#define sv_seti64(a,b) sv_setiv(a,b) |
| 16 |
#define sv_setu64(a,b) sv_setuv(a,b) |
| 17 |
#define newSVi64(a) newSViv(a) |
| 18 |
#define newSVu64(a) newSVuv(a) |
| 19 |
#define XSRETURN_U64(a) XSRETURN_UV(a) |
| 20 |
#define XSRETURN_I64(a) XSRETURN_IV(a) |
| 21 |
#define PERL_MATH_INT64_LOAD_OR_CROAK |
| 22 |
#else |
| 23 |
#define XSRETURN_U64(a) { \ |
| 24 |
ST(0) = sv_newmortal(); \ |
| 25 |
sv_setu64(ST(0), a); \ |
| 26 |
XSRETURN(1); \ |
| 27 |
} |
| 28 |
#define XSRETURN_I64(a) { \ |
| 29 |
ST(0) = sv_newmortal(); \ |
| 30 |
sv_seti64(ST(0), a); \ |
| 31 |
XSRETURN(1); \ |
| 32 |
} |
| 33 |
/* Platypus specific end */ |
| 34 |
|
| 35 |
#if !defined (PERL_MATH_INT64_H_INCLUDED) |
| 36 |
#define PERL_MATH_INT64_H_INCLUDED |
| 37 |
|
| 38 |
#define MATH_INT64_C_API_REQUIRED_VERSION 2 |
| 39 |
#define MATH_INT64_VERSION MATH_INT64_C_API_REQUIRED_VERSION |
| 40 |
|
| 41 |
int perl_math_int64_load(int required_version); |
| 42 |
|
| 43 |
#define PERL_MATH_INT64_LOAD perl_math_int64_load(MATH_INT64_C_API_REQUIRED_VERSION) |
| 44 |
#define PERL_MATH_INT64_LOAD_OR_CROAK \ |
| 45 |
if (PERL_MATH_INT64_LOAD); \ |
| 46 |
else croak(NULL); |
| 47 |
#define MATH_INT64_BOOT PERL_MATH_INT64_LOAD_OR_CROAK |
| 48 |
|
| 49 |
extern HV *math_int64_c_api_hash; |
| 50 |
extern int math_int64_c_api_min_version; |
| 51 |
extern int math_int64_c_api_max_version; |
| 52 |
#define math_int64_capi_version math_int64_c_api_max_version |
| 53 |
|
| 54 |
#if (defined(MATH_INT64_NATIVE_IF_AVAILABLE) && (IVSIZE == 8)) |
| 55 |
#define MATH_INT64_NATIVE 1 |
| 56 |
#endif |
| 57 |
|
| 58 |
extern int64_t (*math_int64_c_api_SvI64)(pTHX_ SV*); |
| 59 |
#define SvI64(a) ((*math_int64_c_api_SvI64)(aTHX_ (a))) |
| 60 |
extern int (*math_int64_c_api_SvI64OK)(pTHX_ SV*); |
| 61 |
#define SvI64OK(a) ((*math_int64_c_api_SvI64OK)(aTHX_ (a))) |
| 62 |
extern uint64_t (*math_int64_c_api_SvU64)(pTHX_ SV*); |
| 63 |
#define SvU64(a) ((*math_int64_c_api_SvU64)(aTHX_ (a))) |
| 64 |
extern int (*math_int64_c_api_SvU64OK)(pTHX_ SV*); |
| 65 |
#define SvU64OK(a) ((*math_int64_c_api_SvU64OK)(aTHX_ (a))) |
| 66 |
extern SV * (*math_int64_c_api_newSVi64)(pTHX_ int64_t); |
| 67 |
#define newSVi64(a) ((*math_int64_c_api_newSVi64)(aTHX_ (a))) |
| 68 |
extern SV * (*math_int64_c_api_newSVu64)(pTHX_ uint64_t); |
| 69 |
#define newSVu64(a) ((*math_int64_c_api_newSVu64)(aTHX_ (a))) |
| 70 |
extern uint64_t (*math_int64_c_api_randU64)(pTHX); |
| 71 |
#define randU64() ((*math_int64_c_api_randU64)(aTHX)) |
| 72 |
|
| 73 |
|
| 74 |
#if MATH_INT64_NATIVE |
| 75 |
|
| 76 |
#undef newSVi64 |
| 77 |
#define newSVi64 newSViv |
| 78 |
#undef newSVu64 |
| 79 |
#define newSVu64 newSVuv |
| 80 |
|
| 81 |
#define sv_seti64 sv_setiv_mg |
| 82 |
#define sv_setu64 sv_setuv_mg |
| 83 |
|
| 84 |
#else |
| 85 |
|
| 86 |
#define sv_seti64(target, i64) (sv_setsv_mg(target, sv_2mortal(newSVi64(i64)))) |
| 87 |
#define sv_setu64(target, u64) (sv_setsv_mg(target, sv_2mortal(newSVu64(u64)))) |
| 88 |
|
| 89 |
#endif |
| 90 |
#endif |
| 91 |
#endif |