From 65b8fcbd8fee82669ac87629a4d55babd47d62cf Mon Sep 17 00:00:00 2001 From: JalonSolov Date: Sat, 4 Nov 2023 14:36:46 -0400 Subject: [PATCH] remove unnecessary casts --- vlib/encoding/utf8/utf8_util.v | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vlib/encoding/utf8/utf8_util.v b/vlib/encoding/utf8/utf8_util.v index b91307b4a2ab99..48cfe03a3849eb 100644 --- a/vlib/encoding/utf8/utf8_util.v +++ b/vlib/encoding/utf8/utf8_util.v @@ -430,14 +430,14 @@ fn up_low(s string, upper_flag bool) string { if upper_flag == true { unsafe { // Subtract 0x20 (ASCII space char) from ASCII lowercase to convert to uppercase. - c := u8(s[index]) - str_res[index] = if c >= u8(0x61) && c <= u8(0x7a) { c - u8(0x20) } else { c } + c := s[index] + str_res[index] = if c >= 0x61 && c <= 0x7a { c - 0x20 } else { c } } } else { unsafe { // Add (ASCII space char) to ASCII uppercase to convert to lowercase. - c := u8(s[index]) - str_res[index] = if c >= u8(0x41) && c <= u8(0x5a) { c + u8(0x20) } else { c } + c := s[index] + str_res[index] = if c >= 0x41 && c <= 0x5a { c + 0x20 } else { c } } } } else if ch_len > 1 && ch_len < 5 {