-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
59 lines (44 loc) · 1.31 KB
/
util.h
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
52
53
54
55
56
57
58
59
#pragma once
#ifndef HETKER_UTIL_H
#define HETKER_UTIL_H
#endif //HETKER_UTIL_H
#include "hetker_lib.h"
#include "strings.h"
typedef struct {
cl_device_id id;
cl_context context;
cl_command_queue queue;
} Device;
typedef struct {
size_t length;
Device* data[CL_MAX_DEVICES];
} DeviceList;
typedef struct {
String* data;
size_t length;
} StringArray;
StringArray allocateStringArray(size_t size);
StringArray wrapStringArray(size_t size, String* data);
StringArray createStringArray1(String* first);
StringArray createStringArray2(String* first, String* second);
StringArray createStringArray3(String* first, String* second, String* third);
void freeStringArray(StringArray array);
typedef struct {
size_t* data;
size_t length;
} SizeArray;
SizeArray allocateSizeArray(size_t size);
SizeArray createSizeArray(size_t size, size_t* data);
SizeArray createSizeArray1(size_t first);
SizeArray createSizeArray2(size_t first, size_t second);
SizeArray createSizeArray3(size_t first, size_t second, size_t third);
void freeSizeArray(SizeArray array);
typedef struct {
int code;
String* message;
} Result;
Result* resultCode(int code);
Result* resultString(int code, String* msg);
Result* result(int code, char* msg);
Result* loggingResult(int code, char* msg);
String* readAll(FILE *F);