mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 12:56:39 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			118 lines
		
	
	
	
		
			3.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			118 lines
		
	
	
	
		
			3.1 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);
 | 
						|
            }           
 | 
						|
    };     
 | 
						|
    
 | 
						|
    class OpFetchLocalShort : public Opcode0
 | 
						|
    {
 | 
						|
        public:
 | 
						|
        
 | 
						|
            virtual void execute (Runtime& runtime)
 | 
						|
            {
 | 
						|
                int index = runtime[0];           
 | 
						|
                int value = runtime.getContext().getLocalShort (index);
 | 
						|
                runtime[0] = *reinterpret_cast<Type_Data *> (&value);
 | 
						|
            }           
 | 
						|
    };    
 | 
						|
 | 
						|
    class OpFetchLocalLong : public Opcode0
 | 
						|
    {
 | 
						|
        public:
 | 
						|
        
 | 
						|
            virtual void execute (Runtime& runtime)
 | 
						|
            {
 | 
						|
                int index = runtime[0];           
 | 
						|
                int value = runtime.getContext().getLocalLong (index);
 | 
						|
                runtime[0] = *reinterpret_cast<Type_Data *> (&value);
 | 
						|
            }           
 | 
						|
    };    
 | 
						|
 | 
						|
    class OpFetchLocalFloat : public Opcode0
 | 
						|
    {
 | 
						|
        public:
 | 
						|
        
 | 
						|
            virtual void execute (Runtime& runtime)
 | 
						|
            {
 | 
						|
                int index = runtime[0];           
 | 
						|
                float value = runtime.getContext().getLocalFloat (index);
 | 
						|
                runtime[0] = *reinterpret_cast<Type_Data *> (&value);
 | 
						|
            }           
 | 
						|
    };    
 | 
						|
}
 | 
						|
 | 
						|
#endif
 | 
						|
 |