You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
760 B
C++
34 lines
760 B
C++
15 years ago
|
#ifndef INTERPRETER_GENERICOPCODES_H_INCLUDED
|
||
|
#define INTERPRETER_GENERICOPCODES_H_INCLUDED
|
||
|
|
||
|
#include "opcodes.hpp"
|
||
|
#include "runtime.hpp"
|
||
|
|
||
|
namespace Interpreter
|
||
|
{
|
||
|
class OpPushInt : public Opcode1
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
virtual void execute (Runtime& runtime, unsigned int arg0)
|
||
|
{
|
||
|
runtime.push (arg0);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
class OpIntToFloat : public Opcode0
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
virtual void execute (Runtime& runtime)
|
||
|
{
|
||
|
Type_Data data = runtime[0];
|
||
|
Type_Float floatValue = static_cast<Type_Float> (data);
|
||
|
runtime[0] = *reinterpret_cast<Type_Data *> (&floatValue);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|