From b87dec4b56737f1d7c78616407a1bc56969bb883 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 llvm-svn: 260455 --- llvm/include/llvm/Bitcode/BitCodes.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/Bitcode/BitCodes.h b/llvm/include/llvm/Bitcode/BitCodes.h index 96c4201..66400b697 100644 --- a/llvm/include/llvm/Bitcode/BitCodes.h +++ b/llvm/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.7.4