Lines Matching +full:de +full:- +full:skew
1 //===--- RustDemangle.cpp ---------------------------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html
12 //===----------------------------------------------------------------------===//
180 /// Returns true if C is a valid mangled character: <0-9a-zA-Z_>.
189 // <symbol-name> = "_R" <path> [<instantiating-crate>]
230 // | "M" <impl-path> <type> // <T> (inherent impl)
231 // | "X" <impl-path> <type> <path> // <T as Trait> (trait impl)
234 // | "I" <path> {<generic-arg>} "E" // ...<T, U> (generic args)
236 // <identifier> = [<disambiguator>] <undisambiguated-identifier>
239 // | <A-Z> // other special namespaces
240 // | <a-z> // internal namespaces
344 // <impl-path> = [<disambiguator>] <path>
345 // <disambiguator> = "s" <base-62-number>
352 // <generic-arg> = <lifetime>
355 // <lifetime> = "L" <base-62-number>
365 // <basic-type> = "a" // i8
524 // <type> = | <basic-type>
533 // | "F" <fn-sig> // fn(...) -> ...
534 // | "D" <dyn-bounds> <lifetime> // dyn Trait<Assoc = X> + Send + 'a
620 // <fn-sig> := [<binder>] ["U"] ["K" <abi>] {<type>} "E" <type>
622 // | <undisambiguated-identifier>
639 // When mangling ABI string, the "-" is replaced with "_". in demangleFnSig()
641 C = '-'; in demangleFnSig()
659 print(" -> "); in demangleFnSig()
664 // <dyn-bounds> = [<binder>] {<dyn-trait>} "E"
676 // <dyn-trait> = <path> {<dyn-trait-assoc-binding>}
677 // <dyn-trait-assoc-binding> = "p" <undisambiguated-identifier> <type>
697 // <binder> = "G" <base-62-number>
707 if (Binder >= Input.size() - BoundLifetimes) { in demangleOptionalBinder()
722 // <const> = <basic-type> <const-data>
770 // <const-data> = ["n"] <hex-number>
773 print('-'); in demangleConstInt()
785 // <const-data> = "0_" // false
803 // <const-data> = <hex-number>
846 // <undisambiguated-identifier> = ["u"] <decimal-number> ["_"] <bytes>
855 if (Error || Bytes > Input.size() - Position) { in parseIdentifier()
888 // Parses base 62 number with <0-9a-zA-Z> as digits. Number is terminated by
892 // <base-62-number> = {<0-9a-zA-Z>} "_"
906 Digit = C - '0'; in parseBase62Number()
908 Digit = 10 + (C - 'a'); in parseBase62Number()
910 Digit = 10 + 26 + (C - 'A'); in parseBase62Number()
931 // <decimal-number> = "0"
932 // | <1-9> {<0-9>}
953 uint64_t D = consume() - '0'; in parseDecimalNumber()
961 // Parses a hexadecimal number with <0-9a-f> as a digits. Returns the parsed
965 // <hex-number> = "0_"
966 // | <1-9a-f> {<0-9a-f>} "_"
982 Value += C - '0'; in parseHexNumber()
984 Value += 10 + (C - 'a'); in parseHexNumber()
995 size_t End = Position - 1; in parseHexNumber()
997 HexDigits = Input.substr(Start, End - Start); in parseHexNumber()
1023 // starting from 1, are De Bruijn indices, referring to higher-ranked lifetimes
1031 if (Index - 1 >= BoundLifetimes) { in printLifetime()
1036 uint64_t Depth = BoundLifetimes - Index; in printLifetime()
1043 printDecimalNumber(Depth - 26 + 1); in printLifetime()
1049 Value = C - 'a'; in decodePunycodeDigit()
1054 Value = 26 + (C - '0'); in decodePunycodeDigit()
1065 Output.setCurrentPosition(std::remove(Start, End, '\0') - Buffer); in removeNullBytes()
1068 // Encodes code point as UTF-8 and stores results in Output. Returns false if
1130 size_t Skew = 38; in decodePunycode() local
1143 while (Delta > (Base - TMin) * TMax / 2) { in decodePunycode()
1144 Delta /= Base - TMin; in decodePunycode()
1147 return K + (((Base - TMin + 1) * Delta) / (Delta + Skew)); in decodePunycode()
1163 if (Digit > (Max - I) / W) in decodePunycode()
1173 T = K - Bias; in decodePunycode()
1178 if (W > Max / (Base - T)) in decodePunycode()
1180 W *= (Base - T); in decodePunycode()
1182 size_t NumPoints = (Output.getCurrentPosition() - OutputSize) / 4 + 1; in decodePunycode()
1183 Bias = Adapt(I - OldI, NumPoints); in decodePunycode()
1185 if (I / NumPoints > Max - N) in decodePunycode()
1240 if (A > std::numeric_limits<uint64_t>::max() - B) { in addAssign()