view runtime/integer.c @ 8:8d74ef7fa357

Improved helper macros and added separate Rhope stack in runtime
author Mike Pavone <pavone@retrodev.com>
date Wed, 13 May 2009 23:37:19 -0400
parents d61550e2c001
children 52d9948def24
line wrap: on
line source

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

Method(_PL_,Int32,2,
	_t_Int32 * left; _t_Int32 * right)
	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

Method(_MN_,Int32,2,
	_t_Int32 * left; _t_Int32 * right)
	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;
}