view runtime/integer.c @ 11:3021dac0d8f5

Stack unwind is so close I can almost taste it
author Mike Pavone <pavone@retrodev.com>
date Tue, 19 May 2009 23:29:55 -0400
parents 52d9948def24
children 31f8182f3433
line wrap: on
line source

#include "integer.h"
#include "builtin.h"
#include "context.h"

#define left ((_t_Int32 *)cdata->params[0])
#define right ((_t_Int32 *)cdata->params[1])

MethodNoLocals(_PL_,Int32,
    NumParams 2,
    CallSpace 1)
    
	CopiedParam(0, left, Int32, TYPE_INT32)
	Param(1, right, Int32, TYPE_INT32)
	
	left->num += right->num;
	
	release_ref((object *)right);
EndFunc

MethodNoLocals(_MN_,Int32,
    NumParams 2,
    CallSpace 1)
    
	CopiedParam(0, left, Int32, TYPE_INT32)
	Param(1, right, Int32, TYPE_INT32)
	
	left->num -= right->num;
	
	release_ref((object *)right);
EndFunc

object * make_Int32(int32_t val)
{
	_t_Int32 * obj;
	object * ret = new_object(TYPE_INT32);
	obj = (_t_Int32 *)ret;
	obj->num = val;
	return ret;
}