Bug 1890277: part 4) Add CSPParser support for the `trusted-types` directive, guarded...
[gecko.git] / tools / jprof / intcnt.h
blob2cf9ec1ff1f10c6f3c68f7ac3694295e2af4704d
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef INTCNT_H
6 #define INTCNT_H
8 class IntCount {
9 public:
10 IntCount();
11 ~IntCount();
12 void clear();
13 int countAdd(int index, int increment = 1);
14 int countGet(int index);
15 int getSize();
16 int getCount(int pos);
17 int getIndex(int pos);
19 IntCount(const IntCount& old) {
20 numInts = old.numInts;
21 if (numInts > 0) {
22 iPair = new IntPair[numInts];
23 for (int i = 0; i < numInts; i++) {
24 iPair[i] = old.iPair[i];
26 } else {
27 iPair = nullptr;
31 private:
32 int numInts;
33 struct IntPair {
34 int idx;
35 int cnt;
36 }* iPair;
39 #endif