From 5e9b7afcd95c30186e122871cd0655623abc67b0 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 10 Feb 2016 22:47:48 +0000 Subject: [PATCH] Bitcode reader: replace DecodeChar6() with a lookup table (NFC) Summary: Measured to be more performant when reading bitcode. Reviewers: rafael, dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16285 From: Mehdi Amini git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260455 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Bitcode/BitCodes.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/llvm/Bitcode/BitCodes.h b/include/llvm/Bitcode/BitCodes.h index 96c42015185..66400b697c5 100644 --- a/include/llvm/Bitcode/BitCodes.h +++ b/include/llvm/Bitcode/BitCodes.h @@ -147,12 +147,8 @@ public: static char DecodeChar6(unsigned V) { assert((V & ~63) == 0 && "Not a Char6 encoded character!"); - if (V < 26) return V+'a'; - if (V < 26+26) return V-26+'A'; - if (V < 26+26+10) return V-26-26+'0'; - if (V == 62) return '.'; - if (V == 63) return '_'; - llvm_unreachable("Not a value Char6 character!"); + return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._" + [V]; } }; -- 2.11.0