File tree Expand file tree Collapse file tree
core/sail/lmdb/src/main/java/org/eclipse/rdf4j/sail/lmdb/inlined Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import org .eclipse .rdf4j .model .Literal ;
1717import org .eclipse .rdf4j .model .ValueFactory ;
1818import org .eclipse .rdf4j .sail .lmdb .ValueIds ;
19+ import org .eclipse .rdf4j .sail .lmdb .Varint ;
1920
2021public class Decimals {
2122
@@ -68,12 +69,11 @@ public static int encodeExponent10Bits(int exponent11) {
6869
6970 // Normal number, unbiased exponent in [-1022, 1023]
7071 int unbiasedExp = exponent11 - 1023 ;
71- int encoded = unbiasedExp + 511 ; // Shift range to [0, 1023]
72- if (encoded < 1 || encoded > 1022 ) {
72+ if (unbiasedExp < 1 || unbiasedExp > 1022 ) {
7373 // Out of range for 10 bits (excluding reserved 0 and 0x3FF)
7474 return -1 ;
7575 }
76- return encoded ;
76+ return ( int ) Integers . encodeZigZag ( unbiasedExp ) ;
7777 }
7878
7979 /**
@@ -91,8 +91,7 @@ public static int decodeExponent10Bits(int encoded) {
9191 // Reserved for NaN/Inf
9292 return 0x7FF ;
9393 }
94- // Normal
95- int unbiased = encoded - 511 ;
94+ int unbiased = (int ) Integers .decodeZigZag (encoded );
9695 return unbiased + 1023 ;
9796 }
9897
You can’t perform that action at this time.
0 commit comments