1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/components/interpreter/localopcodes.hpp
2010-06-28 21:49:48 +02:00

83 lines
2.0 KiB
C++

#ifndef INTERPRETER_LOCALOPCODES_H_INCLUDED
#define INTERPRETER_LOCALOPCODES_H_INCLUDED
#include "opcodes.hpp"
#include "runtime.hpp"
#include "context.hpp"
namespace Interpreter
{
class OpStoreLocalShort : public Opcode0
{
public:
virtual void execute (Runtime& runtime)
{
Type_Data data = runtime[0];
int index = runtime[1];
runtime.getContext().setLocalShort (index, *reinterpret_cast<int *> (&data));
runtime.pop();
runtime.pop();
}
};
class OpStoreLocalLong : public Opcode0
{
public:
virtual void execute (Runtime& runtime)
{
Type_Data data = runtime[0];
int index = runtime[1];
runtime.getContext().setLocalLong (index, *reinterpret_cast<int *> (&data));
runtime.pop();
runtime.pop();
}
};
class OpStoreLocalFloat : public Opcode0
{
public:
virtual void execute (Runtime& runtime)
{
Type_Data data = runtime[0];
int index = runtime[1];
runtime.getContext().setLocalFloat (index, *reinterpret_cast<float *> (&data));
runtime.pop();
runtime.pop();
}
};
class OpFetchIntLiteral : public Opcode0
{
public:
virtual void execute (Runtime& runtime)
{
int intValue = runtime.getIntegerLiteral (runtime[0]);
runtime[0] = intValue;
}
};
class OpFetchFloatLiteral : public Opcode0
{
public:
virtual void execute (Runtime& runtime)
{
float floatValue = runtime.getFloatLiteral (runtime[0]);
runtime[0] = *reinterpret_cast<Type_Data *> (&floatValue);
}
};
}
#endif