aboutsummaryrefslogtreecommitdiff
path: root/vendor/libftm/src/mat/ftm_matnew.c
blob: c7ddb36e734edd6c4fc438da31bbe80a4ce90daa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ftm_matnew.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/05/11 12:56:00 by charles           #+#    #+#             */
/*   Updated: 2020/05/11 13:13:27 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "libftm_mat.h"

t_ftmmat	*ftm_matnew(size_t y, size_t x)
{
	t_ftmmat	*mat;

	if ((mat = malloc(sizeof(t_ftmmat))) == NULL)
		return (NULL);
	if ((mat->m = malloc(sizeof(float) * x * y)) == NULL)
	{
		free(mat);
		return (NULL);
	}
	mat->shape.y = y;
	mat->shape.x = x;
	return (mat);
}