summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-09-07 18:51:58 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-09-07 20:08:01 +0900
commit4924011262e35e3983e245cbfcff15aee7b295f3 (patch)
treee48aa1fdfae411b29880a4ed7e6834bdaf2c4428 /include
parentd6ec0ef59b4c7c95beaad09f77cb5f86a0901b97 (diff)
Added WITH_REAL macros
Added `WITH_REAL` versions to `RB_RANDOM_INTERFACE` macros. Also these macros including "without real" versions no longer contain the terminator (semicolon and comma).
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3024
Diffstat (limited to 'include')
-rw-r--r--include/ruby/random.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/ruby/random.h b/include/ruby/random.h
index 4dd12d5f19..1d45dc25b9 100644
--- a/include/ruby/random.h
+++ b/include/ruby/random.h
@@ -44,14 +44,20 @@ typedef struct {
#define RB_RANDOM_INTERFACE_DECLARE(prefix) \
static void prefix##_init(rb_random_t *, const uint32_t *, size_t); \
static unsigned int prefix##_get_int32(rb_random_t *); \
- static void prefix##_get_bytes(rb_random_t *, void *, size_t); \
- /* end */
+ static void prefix##_get_bytes(rb_random_t *, void *, size_t)
+
+#define RB_RANDOM_INTERFACE_DECLARE_WITH_REAL(prefix) \
+ RB_RANDOM_INTERFACE_DECLARE(prefix); \
+ static double prefix##_get_real(rb_random_t *, int)
#define RB_RANDOM_INTERFACE_DEFINE(prefix) \
prefix##_init, \
prefix##_get_int32, \
- prefix##_get_bytes, \
- /* end */
+ prefix##_get_bytes
+
+#define RB_RANDOM_INTERFACE_DEFINE_WITH_REAL(prefix) \
+ RB_RANDOM_INTERFACE_DEFINE(prefix), \
+ prefix##_get_real
#if defined _WIN32 && !defined __CYGWIN__
typedef rb_data_type_t rb_random_data_type_t;