Backported
b75a6bbc for release/1.35.0
Previous too-optimized implementation had multiple flaws:
* Index calculation did not have enough parenthesis in it which meant
that the value table index was sometimes calculated incorrectly.
This lead to string literal values being read incorrectly.
* Did not take into account string literals longer than 127 characters
* Did not take into account that string literals are modified-utf-8
encoded and simply decoded them as US-ASCII bytes. Essentially all
resources with name containing special characters were indexed
incorrectly up until now.
All of these flaws have been in the code for ages.
gitlab #86
Change-Id: Ibd5ecbaa1cdd1b8be759905bd8c29b9f8e012207
(cherry picked from commit
cd47b6877cee258113eb00523701a57374becfd8)