Correct cache sizing for Uint types 32/84032/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 28 Aug 2019 09:05:19 +0000 (11:05 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 28 Aug 2019 09:05:49 +0000 (11:05 +0200)
There is an off-by-one error in these, fix that up.

Change-Id: I7031e8b59bc2c35741d53d663aba3951f6ee2862
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint16.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint32.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint64.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint8.java

index 439ee37e3f776ca891d625a3d5ead1b15ad93f5b..1ee9c28f93cd1cf0a4b0949606c9f5453e2c3d0e 100644 (file)
@@ -50,7 +50,7 @@ public class Uint16 extends Number implements CanonicalValue<Uint16> {
     /**
      * Cache of first 256 values.
      */
-    private static final Uint16[] CACHE = new Uint16[Uint8.MAX_VALUE_SHORT];
+    private static final Uint16[] CACHE = new Uint16[256];
 
     /**
      * Commonly encountered values.
index 4ef835c22cc11701655bfc2247f592af5b99c834..a0aae17535634f3f031f0ce63d1b013d3c6d15f1 100644 (file)
@@ -51,7 +51,7 @@ public class Uint32 extends Number implements CanonicalValue<Uint32> {
     /**
      * Cache of first 256 values.
      */
-    private static final Uint32[] CACHE = new Uint32[Uint8.MAX_VALUE_SHORT];
+    private static final Uint32[] CACHE = new Uint32[256];
     /**
      * Commonly encountered values.
      */
index 1c4f620ef2ec2e0e9de90eaa0a420b38159760af..8e069fc9cae0a1ab0da02a1dbb18bb83c5f81aa3 100644 (file)
@@ -51,7 +51,7 @@ public class Uint64 extends Number implements CanonicalValue<Uint64> {
     /**
      * Cache of first 256 values.
      */
-    private static final Uint64[] CACHE = new Uint64[Uint8.MAX_VALUE_SHORT];
+    private static final Uint64[] CACHE = new Uint64[256];
     /**
      * Commonly encountered values.
      */
index 97e85c345c6025610e53070d54864f82b8b851a0..8a239e427bc0fda8dfa2bc6f916bcac8a56d4e76 100644 (file)
@@ -41,8 +41,8 @@ public class Uint8 extends Number implements CanonicalValue<Uint8> {
 
     private static final CanonicalValueSupport<Uint8> SUPPORT = new Support();
 
-    static final short MIN_VALUE_SHORT = 0;
-    static final short MAX_VALUE_SHORT = 255;
+    private static final short MIN_VALUE_SHORT = 0;
+    private static final short MAX_VALUE_SHORT = 255;
 
     private static final long serialVersionUID = 1L;
     private static final Uint8[] CACHE = new Uint8[MAX_VALUE_SHORT + 1];