chore: enforce that buffer is power of 2

main
Sean McBride 4 years ago
parent c307f2a166
commit 0707f44989

@ -3,7 +3,12 @@
#include <spinlock/fas.h> #include <spinlock/fas.h>
#include <stdint.h> #include <stdint.h>
#define PERF_WINDOW_BUFFER_SIZE 10 /* Should be Power of 2! */
#define PERF_WINDOW_BUFFER_SIZE 16
#if ((PERF_WINDOW_BUFFER_SIZE == 0) || (PERF_WINDOW_BUFFER_SIZE & (PERF_WINDOW_BUFFER_SIZE - 1)) != 0)
#error "PERF_WINDOW_BUFFER_SIZE must be power of 2!"
#endif
struct perf_window { struct perf_window {
uint64_t buffer[PERF_WINDOW_BUFFER_SIZE]; uint64_t buffer[PERF_WINDOW_BUFFER_SIZE];

Loading…
Cancel
Save