Refactor named wildcards (again)
[ghc.git] / compiler / cbits / genSym.c
1
2 #include "Rts.h"
3
4 static HsInt GenSymCounter = 0;
5 static HsInt GenSymInc = 1;
6
7 HsInt genSym(void) {
8 #if defined(THREADED_RTS)
9 if (n_capabilities == 1) {
10 return GenSymCounter = (GenSymCounter + GenSymInc) & 0xFFFFFF;
11 } else {
12 return atomic_inc((StgWord *)&GenSymCounter, GenSymInc) & 0xFFFFFF;
13 }
14 #else
15 return GenSymCounter = (GenSymCounter + GenSymInc) & 0xFFFFFF;
16 #endif
17 }
18
19 void initGenSym(HsInt NewGenSymCounter, HsInt NewGenSymInc) {
20 GenSymCounter = NewGenSymCounter;
21 GenSymInc = NewGenSymInc;
22 }