File: frequent.h

package info (click to toggle)
cups-filters 1.28.17-3%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,096 kB
  • sloc: ansic: 54,489; cpp: 7,023; sh: 1,911; makefile: 963; xml: 127; perl: 73; php: 28; python: 8
file content (17 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef _FREQUENT_H
#define _FREQUENT_H

#include <stdint.h>

typedef struct _FREQUENT FREQUENT;

// size is the precision/return size: it will find at most >size elements (i.e. all, if there) with frequency > 1/(size+1)
FREQUENT *frequent_new(int size); // - just free() it

void frequent_add(FREQUENT *freq,intptr_t key);

// might return INTPTR_MIN, if not populated
// this is only an approximation!
intptr_t frequent_get(FREQUENT *freq,int pos); // 0 is "most frequent"

#endif