forked from hoshir/zebra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
counter.h
50 lines (25 loc) · 716 Bytes
/
counter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
File: counter.h
Created: March 29, 1999
Modified: December 25, 1999
Author: Gunnar Andersson (gunnar@radagast.se)
Contents: The interface to the counter code.
*/
#ifndef COUNTER_H
#define COUNTER_H
#include "macros.h"
#define INCREMENT_COUNTER( counter ) counter.lo++
#define INCREMENT_COUNTER_BY( counter, term ) counter.lo += (term)
typedef struct {
unsigned int hi;
unsigned int lo;
} CounterType;
void
reset_counter( CounterType *counter );
double
counter_value( CounterType *counter );
void
adjust_counter( CounterType *counter );
void
add_counter( CounterType *sum, CounterType *term );
#endif /* COUNTER_H */