/*
 * sum_float.c
 *
 *  Created on: 01-03-2017
 *      Author: Krzysztof Jakubczyk
 */

#include <math.h>

#include "tdefs.h"
#include "misc.h"

#include "helper.h"
#include "sum_float.h"

int sum_float_initlog(void *arguments, void *logic)
{
	struct sum_float_args *args = (struct sum_float_args *)arguments;
	struct sum_float_logic *log = (struct sum_float_logic *)logic;

	if(set_float_ptr(args->io.in1_float_in,&log->in1))
		return -1;

	if(set_float_ptr(args->io.in2_float_in,&log->in2))
		return -1;

	if(set_float_ptr(args->io.in3_float_in,&log->in3))
		return -1;

	if(set_float_ptr(args->io.out_float_out,&log->out))
		return -1;

	return 0;
}

void sum_float(void *arguments, void *logic)
{
	struct sum_float_logic *log = (struct sum_float_logic *)logic;
//	struct mux_float_args *args = (struct mux_float_args *)arguments;

	*log->out=*log->in1+*log->in2+*log->in3;
}
