Use a simple substraction for converting case 93/97593/3
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 22 Sep 2021 00:02:53 +0000 (02:02 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 22 Sep 2021 00:05:46 +0000 (02:05 +0200)
We are dealing with Latin1 here, just use plain arithmetics guaranteed
to work.

Change-Id: Ie86943401e6cea7bd9d000f6ccc7aa82aa7e9156
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
model/ietf/ietf-type-util/src/main/java/org/opendaylight/mdsal/model/ietf/util/AbstractIetfYangUtil.java

index aa0bcf4991f11db67d097017411b8075d5408f1e..c43cdcacdaa6c6de5422d8bcd07abc06be4f7adb 100644 (file)
@@ -195,7 +195,8 @@ public abstract class AbstractIetfYangUtil<M, P, H, Q, U> {
         for (int i = 0; i < chars.length; ++i) {
             final char c = chars[i];
             if (c >= 'A' && c <= 'F') {
-                chars[i] = Character.toLowerCase(c);
+                // Weird notation to ensure constant folding to '(char) (c + 32)', a well-known property of ASCII
+                chars[i] = (char) (c + ('a' - 'A'));
                 ret = true;
             }
         }