aboutsummaryrefslogtreecommitdiff
path: root/src/vec/ft_vectobuf32.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-02 11:05:33 +0200
commit5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde (patch)
tree80911dc3c32e9f230750e7e1042d413dfb6efab2 /src/vec/ft_vectobuf32.c
parentee32953ea79616e72f5428cdf40c834714a891c9 (diff)
parentb96b82194ccad2cddbb46b77aa1962a57c47ff44 (diff)
downloadlibft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.gz
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.tar.bz2
libft-5d2f925b20ceaea4122c59d2d2c4e7d4ae991fde.zip
Merge branch 'master' into ft_ssl
Diffstat (limited to 'src/vec/ft_vectobuf32.c')
-rw-r--r--src/vec/ft_vectobuf32.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vec/ft_vectobuf32.c b/src/vec/ft_vectobuf32.c
new file mode 100644
index 0000000..d152d37
--- /dev/null
+++ b/src/vec/ft_vectobuf32.c
@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_vectobuf32.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/10 21:09:35 by charles #+# #+# */
+/* Updated: 2020/05/10 21:14:31 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft_vec.h"
+
+void *ft_vectobuf32(t_ftvec *vec)
+{
+ uint32_t *buf;
+ size_t i;
+
+ if ((buf = malloc(sizeof(uint32_t) * vec->size)) == NULL)
+ return (NULL);
+ i = 0;
+ while (i < vec->size)
+ {
+ buf[i] = *(uint32_t*)&vec->data[i];
+ i++;
+ }
+ return (buf);
+}