mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #6791 from mruby/fix/bigint-cxx-compat
This commit is contained in:
@@ -50,11 +50,16 @@ typedef struct mpz_context {
|
||||
mpz_pool_t *pool; /* NULL for heap-only operations */
|
||||
} mpz_ctx_t;
|
||||
|
||||
/* Convenience macros for context creation */
|
||||
/* Convenience macros for context creation.
|
||||
* Uses per-member assignment instead of a C99 compound literal with
|
||||
* designated initializers so the file compiles as C++ on legacy
|
||||
* toolchains (pre-C++20). */
|
||||
#define MPZ_CTX_INIT(mrb_ptr, ctx, pool_ptr) \
|
||||
mpz_pool_t pool ## _storage = {{0}};\
|
||||
mpz_pool_t *pool_ptr = &pool ## _storage;\
|
||||
mpz_ctx_t ctx ## _struct = ((mpz_ctx_t){.mrb = (mrb_ptr), .pool = (pool_ptr)}); \
|
||||
mpz_ctx_t ctx ## _struct; \
|
||||
ctx ## _struct.mrb = (mrb_ptr); \
|
||||
ctx ## _struct.pool = (pool_ptr); \
|
||||
mpz_ctx_t *ctx = &(ctx ## _struct);
|
||||
|
||||
/* Access macros for readability */
|
||||
|
||||
Reference in New Issue
Block a user