mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
cgen: reduce v.c size by ~4% by removing comments and using shorter literals
This commit is contained in:
parent
d7061cbfef
commit
55d004e310
42 changed files with 356 additions and 328 deletions
|
@ -721,12 +721,12 @@ pub const si_g64_code = '0xfe0f'
|
|||
|
||||
@[inline]
|
||||
pub fn str_intp_sq(in_str string) string {
|
||||
return 'str_intp(2, _MOV((StrIntpData[]){{_SLIT("\'"), ${si_s_code}, {.d_s = ${in_str}}},{_SLIT("\'"), 0, {.d_c = 0 }}}))'
|
||||
return 'str_intp(2, _MOV((StrIntpData[]){{_S("\'"), ${si_s_code}, {.d_s = ${in_str}}},{_S("\'"), 0, {.d_c = 0 }}}))'
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn str_intp_rune(in_str string) string {
|
||||
return 'str_intp(2, _MOV((StrIntpData[]){{_SLIT("\`"), ${si_s_code}, {.d_s = ${in_str}}},{_SLIT("\`"), 0, {.d_c = 0 }}}))'
|
||||
return 'str_intp(2, _MOV((StrIntpData[]){{_S("\`"), ${si_s_code}, {.d_s = ${in_str}}},{_S("\`"), 0, {.d_c = 0 }}}))'
|
||||
}
|
||||
|
||||
@[inline]
|
||||
|
@ -752,12 +752,12 @@ pub fn str_intp_sub(base_str string, in_str string) string {
|
|||
st_str := base_str[..index]
|
||||
if index + 2 < base_str.len {
|
||||
en_str := base_str[index + 2..]
|
||||
res_str := 'str_intp(2, _MOV((StrIntpData[]){{_SLIT("${st_str}"), ${si_s_code}, {.d_s = ${in_str} }},{_SLIT("${en_str}"), 0, {.d_c = 0}}}))'
|
||||
res_str := 'str_intp(2, _MOV((StrIntpData[]){{_S("${st_str}"), ${si_s_code}, {.d_s = ${in_str} }},{_S("${en_str}"), 0, {.d_c = 0}}}))'
|
||||
st_str.free()
|
||||
en_str.free()
|
||||
return res_str
|
||||
}
|
||||
res2_str := 'str_intp(1, _MOV((StrIntpData[]){{_SLIT("${st_str}"), ${si_s_code}, {.d_s = ${in_str} }}}))'
|
||||
res2_str := 'str_intp(1, _MOV((StrIntpData[]){{_S("${st_str}"), ${si_s_code}, {.d_s = ${in_str} }}}))'
|
||||
st_str.free()
|
||||
return res2_str
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue