Skip to content

Commit dfd9fce

Browse files
committed
ggml : fix restrict usage
1 parent 36680f6 commit dfd9fce

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ggml.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -1514,9 +1514,15 @@ extern "C" {
15141514
// Internal types and functions exposed for tests and benchmarks
15151515
//
15161516

1517-
typedef void (*ggml_to_float_t)(const void * x, float * y, int k);
1518-
typedef void (*ggml_from_float_t)(const float * x, void * y, int k);
1519-
typedef void (*ggml_vec_dot_t)(const int n, float * s, const void * x, const void * y);
1517+
#ifdef __cplusplus
1518+
// restrict not standard in C++
1519+
#define GGML_RESTRICT
1520+
#else
1521+
#define GGML_RESTRICT restrict
1522+
#endif
1523+
typedef void (*ggml_to_float_t) (const void * GGML_RESTRICT x, float * GGML_RESTRICT y, int k);
1524+
typedef void (*ggml_from_float_t)(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int k);
1525+
typedef void (*ggml_vec_dot_t) (const int n, float * GGML_RESTRICT s, const void * GGML_RESTRICT x, const void * GGML_RESTRICT y);
15201526

15211527
typedef struct {
15221528
ggml_to_float_t to_float;

0 commit comments

Comments
 (0)