| 1 | /* |
| 2 | * perl_math_int64.h - This file is in the public domain |
| 3 | * Author: "Salvador Fandino <sfandino@yahoo.com>, Dave Rolsky <autarch@urth.org>" |
| 4 | * Version: 2.1 |
| 5 | * |
| 6 | * Generated on: 2016-01-04 10:07:18 |
| 7 | * Math::Int64 version: 0.54 |
| 8 | * Module::CAPIMaker version: |
| 9 | */ |
| 10 | |
| 11 | #if !defined (PERL_MATH_INT64_H_INCLUDED) |
| 12 | #define PERL_MATH_INT64_H_INCLUDED |
| 13 | |
| 14 | #define MATH_INT64_C_API_REQUIRED_VERSION 2 |
| 15 | #define MATH_INT64_VERSION MATH_INT64_C_API_REQUIRED_VERSION |
| 16 | |
| 17 | int perl_math_int64_load(int required_version); |
| 18 | |
| 19 | #define PERL_MATH_INT64_LOAD perl_math_int64_load(MATH_INT64_C_API_REQUIRED_VERSION) |
| 20 | #define PERL_MATH_INT64_LOAD_OR_CROAK \ |
| 21 | if (PERL_MATH_INT64_LOAD); \ |
| 22 | else croak(NULL); |
| 23 | #define MATH_INT64_BOOT PERL_MATH_INT64_LOAD_OR_CROAK |
| 24 | |
| 25 | extern HV *math_int64_c_api_hash; |
| 26 | extern int math_int64_c_api_min_version; |
| 27 | extern int math_int64_c_api_max_version; |
| 28 | #define math_int64_capi_version math_int64_c_api_max_version |
| 29 | |
| 30 | #if (defined(MATH_INT64_NATIVE_IF_AVAILABLE) && (IVSIZE == 8)) |
| 31 | #define MATH_INT64_NATIVE 1 |
| 32 | #endif |
| 33 | |
| 34 | extern int64_t (*math_int64_c_api_SvI64)(pTHX_ SV*); |
| 35 | #define SvI64(a) ((*math_int64_c_api_SvI64)(aTHX_ (a))) |
| 36 | extern int (*math_int64_c_api_SvI64OK)(pTHX_ SV*); |
| 37 | #define SvI64OK(a) ((*math_int64_c_api_SvI64OK)(aTHX_ (a))) |
| 38 | extern uint64_t (*math_int64_c_api_SvU64)(pTHX_ SV*); |
| 39 | #define SvU64(a) ((*math_int64_c_api_SvU64)(aTHX_ (a))) |
| 40 | extern int (*math_int64_c_api_SvU64OK)(pTHX_ SV*); |
| 41 | #define SvU64OK(a) ((*math_int64_c_api_SvU64OK)(aTHX_ (a))) |
| 42 | extern SV * (*math_int64_c_api_newSVi64)(pTHX_ int64_t); |
| 43 | #define newSVi64(a) ((*math_int64_c_api_newSVi64)(aTHX_ (a))) |
| 44 | extern SV * (*math_int64_c_api_newSVu64)(pTHX_ uint64_t); |
| 45 | #define newSVu64(a) ((*math_int64_c_api_newSVu64)(aTHX_ (a))) |
| 46 | extern uint64_t (*math_int64_c_api_randU64)(pTHX); |
| 47 | #define randU64() ((*math_int64_c_api_randU64)(aTHX)) |
| 48 | |
| 49 | |
| 50 | #if MATH_INT64_NATIVE |
| 51 | |
| 52 | #undef newSVi64 |
| 53 | #define newSVi64 newSViv |
| 54 | #undef newSVu64 |
| 55 | #define newSVu64 newSVuv |
| 56 | |
| 57 | #define sv_seti64 sv_setiv_mg |
| 58 | #define sv_setu64 sv_setuv_mg |
| 59 | |
| 60 | #else |
| 61 | |
| 62 | #define sv_seti64(target, i64) (sv_setsv_mg(target, sv_2mortal(newSVi64(i64)))) |
| 63 | #define sv_setu64(target, u64) (sv_setsv_mg(target, sv_2mortal(newSVu64(u64)))) |
| 64 | |
| 65 | #endif |
| 66 | |
| 67 | #endif |