Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <stdio.h>

// malloc utilities
void *malloc_rank1(size_t n1, size_t size)
void *malloc_rank1(u_int64_t n1, u_int64_t size)
{
void *A;

Expand All @@ -22,12 +22,12 @@ void *malloc_rank1(size_t n1, size_t size)
}


double ***malloc_rank3(int n1, int n2, int n3)
double ***malloc_rank3(u_int64_t n1, u_int64_t n2, u_int64_t n3)
{

double ***A;
double *space;
int i,j;
u_int64_t i,j;

space = malloc_rank1(n1*n2*n3, sizeof(double));
A = malloc_rank1(n1, sizeof(double *));
Expand All @@ -41,12 +41,12 @@ double ***malloc_rank3(int n1, int n2, int n3)
return A;
}

float ***malloc_rank3_float(int n1, int n2, int n3)
float ***malloc_rank3_float(u_int64_t n1, u_int64_t n2, u_int64_t n3)
{

float ***A;
float *space;
int i,j;
u_int64_t i,j;

space = malloc_rank1(n1*n2*n3, sizeof(float));
A = malloc_rank1(n1, sizeof(float *));
Expand All @@ -60,12 +60,12 @@ float ***malloc_rank3_float(int n1, int n2, int n3)
return A;
}

double ****malloc_rank4(int n1, int n2, int n3, int n4)
double ****malloc_rank4(u_int64_t n1, u_int64_t n2, u_int64_t n3, u_int64_t n4)
{

double ****A;
double *space;
int i,j,k;
u_int64_t i,j,k;

space = malloc_rank1(n1*n2*n3*n4, sizeof(double));
A = malloc_rank1(n1, sizeof(double *));
Expand All @@ -82,12 +82,12 @@ double ****malloc_rank4(int n1, int n2, int n3, int n4)
return A;
}

float ****malloc_rank4_float(int n1, int n2, int n3, int n4)
float ****malloc_rank4_float(u_int64_t n1, u_int64_t n2, u_int64_t n3, u_int64_t n4)
{

float ****A;
float *space;
int i,j,k;
u_int64_t i,j,k;

space = malloc_rank1(n1*n2*n3*n4, sizeof(float));
A = malloc_rank1(n1, sizeof(float *));
Expand Down
8 changes: 4 additions & 4 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#ifndef SRC_UTILS_H_
#define SRC_UTILS_H_

double ***malloc_rank3(int n1, int n2, int n3);
float ***malloc_rank3_float(int n1, int n2, int n3);
double ***malloc_rank3(u_int64_t n1, u_int64_t n2, u_int64_t n3);
float ***malloc_rank3_float(u_int64_t n1, u_int64_t n2, u_int64_t n3);

double ****malloc_rank4(int n1, int n2, int n3, int n4);
float ****malloc_rank4_float(int n1, int n2, int n3, int n4);
double ****malloc_rank4(u_int64_t n1, u_int64_t n2, u_int64_t n3, u_int64_t n4);
float ****malloc_rank4_float(u_int64_t n1, u_int64_t n2, u_int64_t n3, u_int64_t n4);

#endif /* SRC_UTILS_H_ */