view runtime/integer.c @ 10:0f2c4ee070fe

Changes to calldata struct for stack unwind
author Mike Pavone <pavone@retrodev.com>
date Sat, 16 May 2009 23:24:24 -0400
parents 52d9948def24
children 3021dac0d8f5
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,2)
	call = alloc_cdata(cdata->ct, 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,2)
	call = alloc_cdata(cdata->ct, 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;
}