Skip to content

Commit b11952f

Browse files
committed
ENH: add native cython and cffi API mode
1 parent 41db64e commit b11952f

File tree

4 files changed

+1088
-1078
lines changed

4 files changed

+1088
-1078
lines changed

c_from_python.ipynb

Lines changed: 1083 additions & 1066 deletions
Large diffs are not rendered by default.

create_fractal.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
int mandel(float x, float y, int max_iters, unsigned char * val);
1+
#include "create_fractal.h"
22

3-
typedef struct _Img{
4-
int width;
5-
int height;
6-
unsigned char * data;
7-
} Img;
8-
9-
10-
void create_fractal(Img img, int iters) {
3+
int create_fractal(Img img, int iters) {
114
float pixel_size_x = 3.0 / img.width;
125
float pixel_size_y = 2.0 / img.height;
136
int x, y;

create_fractal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ typedef struct _Img{
22
int width;
33
int height;
44
unsigned char * data;
5-
} cImg;
5+
} Img;
66

77

88

9-
int create_fractal(cImg img, int iters);
9+
int create_fractal(Img img, int iters);
1010
int mandel(float real, float imag, int max_iters, unsigned char * val);
1111

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int main(int argc, const char *argv[], const char * env[])
2626
int height = 1000;
2727
int iters = 20;
2828
FILE * fid = NULL;
29-
cImg img;
29+
Img img;
3030
size_t written;
3131
#ifdef CLOCK_PROCESS_CPUTIME_ID
3232
struct timespec vartime;

0 commit comments

Comments
 (0)