-
Notifications
You must be signed in to change notification settings - Fork 1
/
core.c
51 lines (47 loc) · 1.06 KB
/
core.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
extern void printfloat(double);
extern void printint(int64_t);
extern void printstr(int64_t *);
extern int64_t getindex(int64_t *, int64_t);
extern void setindex(int64_t *, int64_t, int64_t);
extern int64_t copy(int64_t *, int64_t *, int64_t);
void printstr(int64_t *str) {
int64_t len = str[0];
for (int i = 0; i < len; i++) {
int64_t c = *(str + (8 * (i + 1)));
printf("%c", c);
}
printf("\n");
}
//
void printint(int64_t n) {
printf("%d\n", n);
}
int64_t printnum(int64_t *n) {
printf("%d\n", *n);
return 0;
}
int64_t getindex(int64_t *arr, int64_t i) {
return *(arr + (8 * (i + 1)));
}
void setindex(int64_t *arr, int64_t i, int64_t val) {
*(arr + (8 * (i + 1))) = val;
}
int64_t copy(int64_t *a, int64_t *b, int64_t c) {
printf("size: %d\n", c);
return (int64_t)memcpy(a, b, c);
}
void printfloat(double x) {
printf("%x\n", x);
printf("%b\n", x);
printf("%lf\n", &x);
};
//
// printnum(pointer);
//
// return 0;
// }