if im writing a function that takes a string as an argument how would I traverse the string?
I thought we have to multiply the index by 8 since RISC-V is byte addressible. ex
slli x5, x5, 3 ;; x6 contains index i
add a0, a0, x6 ;; a0 contains address of arg string at index i
lb x6, 0(a0)
This is how I thought I would get char I in the string, but apparently I'm wrong. Do we only multiply but 8 for doublewords? if so, do we multiply by 4 for words, 2 for halfwords, and nothing for chars?
If a0 was an array of long long ints, then I know for sure we slli
by 3 (multiply by 8), so I'm guessing we multiply based on the amount of bytes a given data type naturally takes.