summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2024-11-29 23:33:47 +0900
committerYusuke Endoh <[email protected]>2024-11-30 00:03:07 +0900
commit8aeb67de7dd9c8cf505985be45cd0efcea88f895 (patch)
tree9004bf28213e37bc073adb5a89c3478934db1d93 /random.c
parent705714be3e8aee2a295bea8789b997f5dd2450cc (diff)
Remove a useless condition expression
`len` is always at least 1 here.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12215
Diffstat (limited to 'random.c')
-rw-r--r--random.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/random.c b/random.c
index 9f9014cf7c..f6f63e4cff 100644
--- a/random.c
+++ b/random.c
@@ -378,8 +378,8 @@ rand_init(const rb_random_interface_t *rng, rb_random_t *rnd, VALUE seed)
INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
if (sign < 0)
sign = -sign;
- if (len <= 1) {
- rng->init_int32(rnd, len ? buf[0] : 0);
+ if (len == 1) {
+ rng->init_int32(rnd, buf[0]);
}
else {
if (sign != 2 && buf[len-1] == 1) /* remove leading-zero-guard */