Linux 4.19.133
[linux/fpc-iii.git] / tools / perf / util / xyarray.h
blob2627b038b6f2a2886ea43b279f308a2516ad2d0a
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PERF_XYARRAY_H_
3 #define _PERF_XYARRAY_H_ 1
5 #include <linux/compiler.h>
6 #include <sys/types.h>
8 struct xyarray {
9 size_t row_size;
10 size_t entry_size;
11 size_t entries;
12 size_t max_x;
13 size_t max_y;
14 char contents[] __aligned(8);
17 struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size);
18 void xyarray__delete(struct xyarray *xy);
19 void xyarray__reset(struct xyarray *xy);
21 static inline void *xyarray__entry(struct xyarray *xy, int x, int y)
23 return &xy->contents[x * xy->row_size + y * xy->entry_size];
26 static inline int xyarray__max_y(struct xyarray *xy)
28 return xy->max_y;
31 static inline int xyarray__max_x(struct xyarray *xy)
33 return xy->max_x;
36 #endif /* _PERF_XYARRAY_H_ */