12345678910111213141516171819202122232425 |
- #ifndef _JUMP_MONOTONIC_QUEUE_H
- #define _JUMP_MONOTONIC_QUEUE_H 1
- #define MONOTONIC_QUEUE_CAP 80
- typedef int (*monotonic_queue_cmp)(float, float);
- struct monotonic_queue
- {
- monotonic_queue_cmp cmp;
- float buf[MONOTONIC_QUEUE_CAP];
- int h, h_min, t;
- int len;
- };
- extern void monotonic_queue_init(struct monotonic_queue *mq,
- monotonic_queue_cmp cmp);
- extern int monotonic_queue_push(struct monotonic_queue *mq, float value);
- extern int monotonic_queue_pop(struct monotonic_queue *mq);
- extern int monotonic_queue_get_min(struct monotonic_queue *mq, float *dest);
- extern int monotonic_queue_get_len(struct monotonic_queue *mq);
- #endif
- /* vim: set ts=8 sw=8 sts=8 noet: */
|