diff options
| author | Yusuke Endoh <mame@ruby-lang.org> | 2024-11-29 23:33:47 +0900 |
|---|---|---|
| committer | Yusuke Endoh <mame@ruby-lang.org> | 2024-11-30 00:03:07 +0900 |
| commit | 8aeb67de7dd9c8cf505985be45cd0efcea88f895 (patch) | |
| tree | 9004bf28213e37bc073adb5a89c3478934db1d93 /random.c | |
| parent | 705714be3e8aee2a295bea8789b997f5dd2450cc (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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 */ |
