[前][次][番号順一覧][スレッド一覧]

ruby-changes:62855

From: Nobuyoshi <ko1@a...>
Date: Mon, 7 Sep 2020 20:08:28 +0900 (JST)
Subject: [ruby-changes:62855] c449b9b02f (master): Added rb_int_pair_to_real

https://git.ruby-lang.org/ruby.git/commit/?id=c449b9b02f

From c449b9b02f63cf8268a0eb9639a43caf4598996d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 15 Apr 2020 00:45:38 +0900
Subject: Added rb_int_pair_to_real


diff --git a/include/ruby/random.h b/include/ruby/random.h
index bb6cf73..21b6796 100644
--- a/include/ruby/random.h
+++ b/include/ruby/random.h
@@ -63,8 +63,7 @@ typedef const rb_data_type_t rb_random_data_type_t; https://github.com/ruby/ruby/blob/trunk/include/ruby/random.h#L63
 #endif
 
 void rb_random_mark(void *ptr);
-double rb_int_pair_to_real_exclusive(uint32_t a, uint32_t b);
-double rb_int_pair_to_real_inclusive(uint32_t a, uint32_t b);
+double rb_int_pair_to_real(uint32_t a, uint32_t b, int excl);
 void rb_rand_bytes_int32(rb_random_get_int32_func *, rb_random_t *, void *, size_t);
 RUBY_EXTERN const rb_data_type_t rb_random_data_type;
 
diff --git a/random.c b/random.c
index 08c6918..3fef5ce 100644
--- a/random.c
+++ b/random.c
@@ -992,6 +992,12 @@ random_real(VALUE obj, rb_random_t *rnd, int excl) https://github.com/ruby/ruby/blob/trunk/random.c#L992
         a = random_int32(rng, rnd);
         b = random_int32(rng, rnd);
     }
+    return rb_int_pair_to_real(a, b, excl);
+}
+
+double
+rb_int_pair_to_real(uint32_t a, uint32_t b, int excl)
+{
     if (excl) {
 	return int_pair_to_real_exclusive(a, b);
     }
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]