From 009ec37a47e2f2b5e7f928004fbc3403f0bd8abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lourens=20Naud=C3=A9?= Date: Sat, 13 Apr 2019 17:39:05 +0100 Subject: Let the index boundary check in rb_enc_from_index be flagged as unlikely [Misc #15806] Closes: https://github.com/ruby/ruby/pull/2128 --- encoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'encoding.c') diff --git a/encoding.c b/encoding.c index 9655213f73..908a6458a0 100644 --- a/encoding.c +++ b/encoding.c @@ -608,7 +608,7 @@ rb_enc_init(void) rb_encoding * rb_enc_from_index(int index) { - if (index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK)) { + if (UNLIKELY(index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK))) { return 0; } return enc_table.list[index].enc; -- cgit v1.2.1