/*
 * mux_float.c
 *
 *  Created on: 28-02-2017
 *      Author: Krzysztof Jakubczyk
 */

#include <math.h>

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

#include "helper.h"
#include "mux_float.h"

int mux_float_initlog(void *arguments, void *logic)
{
	struct mux_float_args *args = (struct mux_float_args *)arguments;
	struct mux_float_logic *log = (struct mux_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_bit_ptr_struct(args->io.addr_in,&log->addr))
		return -1;

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

	return 0;
}

void mux_float(void *arguments, void *logic)
{
	struct mux_float_logic *log = (struct mux_float_logic *)logic;
//	struct mux_float_args *args = (struct mux_float_args *)arguments;

	*log->out=check_struct(&log->addr)?*log->in2:*log->in1;
}
