mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Replace mwscript program serialization into a vector with simple struct
Mostly to avoid string literal lookup by index with iteration over all preciding literals and calling strlen. This is very inefficient. In genral this makes code much more straightforward but also makes it portable since now int and float of different sizes are properly supported.
This commit is contained in:
parent
60eede6a1d
commit
b88f0d2dbd
21 changed files with 93 additions and 162 deletions
|
@ -17,18 +17,11 @@ namespace Compiler
|
|||
std::vector<std::string> mStrings;
|
||||
|
||||
public:
|
||||
int getIntegerSize() const;
|
||||
///< Return size of integer block (in bytes).
|
||||
const std::vector<Interpreter::Type_Integer>& getIntegers() const { return mIntegers; }
|
||||
|
||||
int getFloatSize() const;
|
||||
///< Return size of float block (in bytes).
|
||||
const std::vector<Interpreter::Type_Float>& getFloats() const { return mFloats; }
|
||||
|
||||
int getStringSize() const;
|
||||
///< Return size of string block (in bytes).
|
||||
|
||||
void append(std::vector<Interpreter::Type_Code>& code) const;
|
||||
///< Apepnd literal blocks to code.
|
||||
/// \note code blocks will be padded for 32-bit alignment.
|
||||
const std::vector<std::string>& getStrings() const { return mStrings; }
|
||||
|
||||
int addInteger(Interpreter::Type_Integer value);
|
||||
///< add integer liternal and return index.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue