2 * (C) Copyright 2017 Pantheon Technologies, s.r.o. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.opendaylight.yangtools.triemap;
18 import static com.google.common.base.Verify.verify;
20 import com.google.common.math.IntMath;
21 import java.math.RoundingMode;
24 * Various implementation-specific constants shared across classes.
26 * @author Robert Varga
28 final class Constants {
30 throw new UnsupportedOperationException();
34 * Size of the hash function, in bits.
36 static final int HASH_BITS = Integer.SIZE;
39 * Size of the CNode bitmap, in bits.
41 static final int BITMAP_BITS = Integer.SIZE;
44 * Number of hash bits consumed in each CNode level.
46 static final int LEVEL_BITS = 5;
49 * Maximum depth of a TrieMap.
51 static final int MAX_DEPTH = 7;
54 verify(LEVEL_BITS == IntMath.log2(BITMAP_BITS, RoundingMode.UNNECESSARY));
55 verify(MAX_DEPTH == IntMath.divide(HASH_BITS, LEVEL_BITS, RoundingMode.CEILING));