-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_cmp.c
35 lines (31 loc) · 1.37 KB
/
math_cmp.c
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
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* math_cmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbrophy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/21 18:56:51 by dbrophy #+# #+# */
/* Updated: 2020/02/21 18:56:51 by dbrophy ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "libftmath.h"
int mtxcmp(t_mtx *a, t_mtx *b)
{
size_t size;
if (a == NULL || b == NULL)
return (a == b);
if (a->x_size != b->x_size || a->y_size != b->y_size)
return (-1);
size = sizeof(double) * a->x_size * a->y_size;
return (ft_memcmp(a->mem, b->mem, size) == 0);
}
int veccmp(t_vector *a, t_vector *b)
{
if (a == NULL || b == NULL)
return (a == b);
if (a->size != b->size)
return (-1);
return (ft_memcmp(a->vals, b->vals, sizeof(double) * a->size) == 0);
}