-
Notifications
You must be signed in to change notification settings - Fork 0
/
increment_offset.c
34 lines (32 loc) · 1.21 KB
/
increment_offset.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
/* ************************************************************************** */
/* */
/* :::::::: */
/* increment_offset.c :+: :+: */
/* +:+ */
/* By: lgutter <lgutter@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2019/03/24 18:06:38 by lgutter #+# #+# */
/* Updated: 2019/03/24 18:06:39 by lgutter ######## odam.nl */
/* */
/* ************************************************************************** */
int increment_offset(unsigned int *tet, unsigned short di)
{
unsigned char *offx;
unsigned char *offy;
offx = (unsigned char *)(tet) + 2;
offy = (unsigned char *)(tet) + 3;
if (*offx < di)
*offx = *offx + 1;
else if (*offy < di)
{
*offx = 0;
*offy = *offy + 1;
}
else
{
*offx = 0;
*offy = 0;
return (-1);
}
return (1);
}